WordPress.org

Plugin Directory

Changeset 1517648


Ignore:
Timestamp:
10/19/16 03:00:42 (10 months ago)
Author:
aaronrutley
Message:

version 1.2.0

Location:
acf-theme-code/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • acf-theme-code/trunk/acf_theme_code.php

    r1474430 r1517648  
    44Plugin URI: http://www.acfthemecode.com/ 
    55Description: Generates theme code for ACF field groups to speed up development. 
    6 Version: 1.1.1 
     6Version: 1.2.0 
    77Author: Aaron Rutley, Ben Pearson 
    88Author URI: http://www.acfthemecode.com/ 
  • acf-theme-code/trunk/assets/acf-theme-code.css

    r1467319 r1517648  
    109109    padding:10px; 
    110110} 
     111 
     112.acftc-pro-notice { 
     113    display: block; 
     114    margin-top:20px; 
     115    background: #f1f1f1; 
     116} 
     117 
     118a.acftc-pro-notice__link { 
     119    padding:10px 20px; 
     120    text-decoration: none; 
     121    font-weight: normal; 
     122    display: block; 
     123    text-align: left; 
     124    box-sizing: border-box; 
     125    color:#999; 
     126    transition: all 300ms ease-in; 
     127} 
     128 
     129a.acftc-pro-notice__link:hover { 
     130    background: #0073aa; 
     131    color:#FFF; 
     132} 
     133 
     134.acftc-intro-notice { 
     135    padding:10px 20px; 
     136} 
     137 
     138.li-field-label { 
     139    width: 31% !important; 
     140} 
     141.li-field-type { 
     142    width: 22% !important; 
     143} 
  • acf-theme-code/trunk/assets/acf-theme-code.js

    r1458037 r1517648  
    1 // jQuery doc ready  
     1// jQuery doc ready 
    22(function($) { 
    33    $(document).ready(function() { 
    4          
    5         // prevent # linking to top of page  
     4 
     5        // prevent # linking to top of page 
    66        $( "a.acftc-field__copy" ).click(function( event ) { 
    77            event.preventDefault(); 
    88        }); 
     9 
     10        // ACF 4 - add anchor link to each field object 
     11        $( "div.field" ).each(function( index ) { 
     12            var field_key = $(this).attr("data-id"); 
     13            var data_type = $(this).attr("data-type"); 
     14            if ( ( data_type != 'tab' ) && ( data_type != 'message') ) { 
     15                $(this).find('.row_options').append( '<span>| <a class="acftc-scroll__link" href="#acftc-' + field_key + '">Code</a></span>' ); 
     16            } 
     17        }); 
     18 
     19        // ACF 5 - add anchor link to each field object 
     20        var fieldsV5 = $('#acf-field-group-fields .acf-field-object') 
     21 
     22            // exclude nested fields 
     23            .filter( function() { 
     24                return $(this).parentsUntil('#acf-field-group-fields', '.acf-field-object').length === 0; 
     25            }); 
     26 
     27        fieldsV5.each(function( index ) { 
     28 
     29            var field_key = $(this).attr("data-id"); 
     30            var data_type = $(this).attr("data-type"); 
     31 
     32            // no code is generated for tab and message fields 
     33            if ( ( data_type != 'tab' ) && ( data_type != 'message') ) { 
     34 
     35                $(this).find( '.row-options' ).eq( 0 ).append( '<a class="acftc-scroll__link" href="#acftc-' + field_key + '">Code</a>' ); 
     36 
     37            } 
     38 
     39        }); 
     40 
     41        // smooth scroll - with offset for title and WP admin bar 
     42        $('a[href*=#]:not([href=#])').click(function() { 
     43            if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 
     44              var target = $(this.hash); 
     45              target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 
     46              var target_offset = target.offset().top; 
     47 
     48              // after the large bp, the header is fixed 
     49              if (window.matchMedia("(max-width: 782px)").matches) { 
     50                var customoffset = 80; // increase offset for small screens 
     51              } else { 
     52                var customoffset = 60; // default offset for large screens 
     53              } 
     54 
     55              if (target.length) { 
     56                $('html,body').animate({ 
     57                  scrollTop: target_offset - customoffset 
     58                }, 1000); 
     59                return false; 
     60              } 
     61            } 
     62        }); 
     63 
    964    }); 
    10      
     65 
    1166 } )( jQuery ); 
    12   
     67 
    1368 // Instantiate clipboard 
    1469 
    1570(function(){ 
    16      
     71 
    1772    var copyCode = new Clipboard('.acftc-field__copy', { 
    1873        target: function(trigger) { 
    1974            return trigger.nextElementSibling; 
    2075        } 
    21  
    2276    }); 
    2377 
    2478    copyCode.on('success', function(e) { 
    25         //console.info('Action:', e.action); 
    26         //console.info('Text:', e.text); 
    27         //console.info('Trigger:', e.trigger); 
    2879        e.clearSelection(); 
    2980    }); 
  • acf-theme-code/trunk/core/core.php

    r1467320 r1517648  
    153153        } 
    154154 
    155         $parent_field_group->render_field_group(); 
     155        if ( !empty( $parent_field_group->fields ) ) { 
     156 
     157            $parent_field_group->render_field_group(); 
     158 
     159            // Upgrade to TC Pro notice 
     160            echo '<div class="acftc-pro-notice"><a class="acftc-pro-notice__link" href="https://hookturn.io/downloads/acf-theme-code-pro/?utm_source=acftcfree" target="_blank">Upgrade to <strong>ACF Theme Code Pro</strong>.</a></div>'; 
     161 
     162        } else { 
     163 
     164            echo '<div class="acftc-intro-notice"><p>Create some fields and publish the field group to generate theme code.</p></div>'; 
     165 
     166        } 
     167 
    156168    } 
    157169 
  • acf-theme-code/trunk/core/field.php

    r1467319 r1517648  
    1414    private $indent_count; 
    1515    private $indent = ''; 
     16    private $quick_link_id = ''; 
    1617    private $the_field_method = 'the_field'; 
    1718    private $get_field_method = 'get_field'; 
     
    9495            $this->type = $this->settings['type']; 
    9596 
     97            // if field is not nested 
     98            if ( 0 == $this->nesting_level ) { 
     99 
     100                // get quick link id 
     101                $this->quick_link_id = $this->settings['key']; 
     102 
     103            } 
     104 
    96105        } 
    97106 
     
    112121            $this->type = $this->settings['type']; 
    113122 
     123            // if field is not nested 
     124            if ( 0 == $this->nesting_level ) { 
     125 
     126                // get quick link id 
     127                $this->quick_link_id = $this->id; 
     128 
     129            } 
     130 
    114131        } 
    115132 
     
    180197 
    181198                // open div for field code wrapper (used for the button etc) 
    182                 echo '<div class="acftc-field-code">'; 
     199                echo '<div class="acftc-field-code" id="acftc-' . $this->quick_link_id . '">'; 
     200 
    183201 
    184202                // copy button 
  • acf-theme-code/trunk/readme.txt

    r1511343 r1517648  
    11=== ACF Theme Code === 
    2 Contributors: aaronrutley, benpearson 
     2Contributors: aaronrutley, ben-pearson 
    33Tags: acf,advanced custom fields,php,automation 
    44Requires at least: 4.5.3 
    55Tested up to: 4.6 
    6 Stable tag: 1.0.0 
     6Stable tag: 1.2.0 
    77License: GPL2+ 
    88 
    9 ACF Theme Code automatically generates the code required to implement Advanced Custom Fields in your themes 
     9ACF Theme Code will automatically generate the code needed to implement Advanced Custom Fields in your themes! 
    1010 
    1111== Description == 
     
    5656* ACF Pro version 5.4 or higher 
    5757 
     58= Thankyou = 
     59Thanks to all of our beta testers including Elliot Condon, Phil Smart, Richard Johnston & James Bundey! 
     60 
    5861== Installation == 
    5962 
     
    8083== Changelog == 
    8184 
     85= 1.2.0 = 
     86* Core: Quicklinks feature with anchor links to the relevant theme code block 
     87* Core: Notice updates & various bug fixes 
     88 
     89= 1.1.2 = 
     90* Fix: Use the_sub_field method for nested File fields with return format URL 
     91 
    8292= 1.1.1 = 
    8393* Field: Post Object field now works correctly for ACF 4 
  • acf-theme-code/trunk/render/file.php

    r1474430 r1517648  
    4040if ( $return_format == 'url' ) { 
    4141    echo $this->indent . htmlspecialchars("<?php if ( ".$this->get_field_method . "( '".$this->name."' ) ) { ?>")."\n"; 
    42     echo $this->indent . htmlspecialchars(" <a href=\"<?php the_field( '".$this->name."' ); ?>\">Download File</a>")."\n"; 
     42    echo $this->indent . htmlspecialchars(" <a href=\"<?php " . $this->the_field_method . "( '".$this->name."' ); ?>\">Download File</a>")."\n"; 
    4343    echo $this->indent . htmlspecialchars("<?php } ?>"."\n"); 
    4444} 
Note: See TracChangeset for help on using the changeset viewer.