WordPress.org

Plugin Directory

Changeset 1474430


Ignore:
Timestamp:
08/15/16 06:55:22 (10 months ago)
Author:
aaronrutley
Message:

v1.1.1

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

Legend:

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

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

    r1467319 r1474430  
    1212ACF Theme Code is an extension for the awesome [Advanced Custom Fields](https://wordpress.org/plugins/advanced-custom-fields/) plugin. 
    1313 
    14 We've created this plugin to save developers time when it comes to implementing Advanced Custom Fields in their WordPress themes. 
     14When you publish, edit or update an ACF Field Group, the code required to implement each field is displayed for you in the Theme Code section at the bottom of the page. 
    1515 
    16 = Existing / common ACF workflow: = 
    17  
    18 1. Create Field Group 
    19 2. Search ACF documentation for how to implement a particular field type and it's settings (return values etc) 
    20 3. Copy example code from ACF documentation and paste it into your theme or plugin 
    21 4. Go through and customise all the field names in the example code 
    22  
    23 = New / improved workflow with ACF Theme Code: = 
    24  
    25 1. Create Field Group 
    26 2. Use clipboard icon to copy and paste a field's already customised code into your theme 
    27  
    28 No more constantly referring to the ACF documentation to see how to implement a particular field. No more customising field names in code examples. 
     16The code is based on the ACF documentation and it's automatically updated to match the fields you have created. 
     17Use the clipboard icon to easily copy these code blocks and paste them into your theme to get you started and save loads of time! 
    2918 
    3019= Features include: = 
    31 * Easily copy / paste the field code into your theme 
     20* Easily copy the code into your theme 
    3221* Great for offline documentation 
    33 * Code generated is based on examples from the official ACF documentation 
    34  
    35 > <strong>Upgrade to ACF Theme Code Pro</strong><br> 
    36 > ALL ACF Pro field types are supported, including the popular Repeater, Flexible Content and Gallery field types. 
    37 > 10+ ACF Add-on field types are also supported, including Font Awesome and Image Crop. 
    38 > [Find out more about ACF Theme Code Pro](https://hookturn.io/downloads/acf-theme-code-pro/) 
     22* Based on the official ACF documentation 
     23* Field names and variables are automatically updated 
    3924 
    4025= Support for the following fields: = 
     
    6045* Taxonomy (Checkbox, Multi Select, Radio Buttons and Select field types) 
    6146 
     47> <strong>Upgrade to ACF Theme Code Pro</strong><br> 
     48> ACF Theme Code Pro generates code for all ACF Pro field types including the Clone, Repeater, Gallery and Flexible Content field.<br> 
     49> ACF Theme Code Pro generates code for a range of popular 3rd party fields including the Font Awesome field and Image Crop Field.<br> 
     50> [Find out more about ACF Theme Code Pro](https://hookturn.io/downloads/acf-theme-code-pro/) 
     51 
    6252= Requires = 
    6353* ACF version 4.4.7 or higher 
    64 * ACF Pro version 5.3.9 or higher 
     54* ACF Pro version 5.4 or higher 
    6555 
    6656== Installation == 
     
    8474 
    8575== Screenshots == 
    86 1. When you publish, edit or update an ACF Field Group, the code required to implement each field is displayed for you in the Template Code section below. Use the clipboard icon to easily copy these code blocks and paste them into your theme. 
     761. When you publish, edit or update an ACF Field Group, the code required to implement each field is displayed for you in the Theme Code section. Use the clipboard icon to easily copy these code blocks and paste them into your theme. 
    8777 
    8878== Changelog == 
    8979 
     80= 1.1.1 = 
     81* Field: Post Object field now works correctly for ACF 4 
     82* Core: Various internal code improvements 
     83 
    9084= 1.1.0 = 
    91 * Various field formatting improvements inline with ACF Theme Code Pro 
     85* Fields: All field formatting improved inline with ACF Theme Code Pro 
    9286 
    9387= 1.0.0 = 
    94 * First version 
     88* Core: First version 
  • acf-theme-code/trunk/render/checkbox.php

    r1467319 r1474430  
    55if ( ! defined( 'ABSPATH' ) ) exit; 
    66 
    7 $return_format = $this->settings['return_format']; 
     7$return_format = isset( $this->settings['return_format'] ) ? $this->settings['return_format'] : ''; 
     8 
    89// echo htmlspecialchars('<h3>'.$return_format.'</h3>')."\n"; 
    910 
     
    2324 
    2425    // Return the code to output the value from a multi dimensional array 
    25     echo $this->indent . htmlspecialchars("<?php // ".$this->name." (".$return_format.")")."\n"; 
     26    echo $this->indent . htmlspecialchars("<?php // ".$this->name." ( ".$return_format." )")."\n"; 
    2627    echo $this->indent . htmlspecialchars("\$".$this->name."_array = ". $this->get_field_method . "( '" . $this->name . "' );")."\n"; 
    2728    echo $this->indent . htmlspecialchars("if ( \$".$this->name."_array ):")."\n"; 
  • acf-theme-code/trunk/render/file.php

    r1467322 r1474430  
    55if ( ! defined( 'ABSPATH' ) ) exit; 
    66 
    7  
    87if ( "postmeta" == ACFTC_Core::$db_table ) { // ACF 
    9     $return_format = $this->settings['save_format']; 
     8    $return_format = isset( $this->settings['save_format'] ) ? $this->settings['save_format'] : ''; 
    109} elseif ( "posts" == ACFTC_Core::$db_table ) { // ACF PRO 
    11     $return_format = $this->settings['return_format']; 
     10    $return_format = isset( $this->settings['return_format'] ) ? $this->settings['return_format'] : ''; 
    1211} 
    1312 
  • acf-theme-code/trunk/render/google_map.php

    r1467319 r1474430  
    55if ( ! defined( 'ABSPATH' ) ) exit; 
    66 
    7  
    87// Location stored in array for now 
    98echo $this->indent . htmlspecialchars("<?php \$location_array = " .  $this->get_field_method . "( '" . $this->name . "' );")."\n"; 
  • acf-theme-code/trunk/render/image.php

    r1467322 r1474430  
    55if ( ! defined( 'ABSPATH' ) ) exit; 
    66 
    7  
    87if ( "postmeta" == ACFTC_Core::$db_table ) { // ACF 
    9     $return_format = $this->settings['save_format']; 
     8    $return_format = isset( $this->settings['save_format'] ) ? $this->settings['save_format'] : ''; 
    109} elseif ( "posts" == ACFTC_Core::$db_table ) { // ACF PRO 
    11     $return_format = $this->settings['return_format']; 
     10    $return_format = isset( $this->settings['return_format'] ) ? $this->settings['return_format'] : ''; 
    1211} 
    1312 
  • acf-theme-code/trunk/render/page_link.php

    r1467319 r1474430  
    55if ( ! defined( 'ABSPATH' ) ) exit; 
    66 
    7  
    87// Check if single or multiple values can be stored 
    9 $multiple_values = $this->settings['multiple']; 
     8// NOTE: Value is a string 
     9$multiple_values = isset( $this->settings['multiple'] ) ? $this->settings['multiple'] : ''; 
    1010 
    1111// If single 
    12 if($multiple_values == 0) { 
     12if($multiple_values == '0') { 
    1313    echo $this->indent . htmlspecialchars("<?php " . $this->the_field_method . "( '" . $this->name . "' ); ?>")."\n"; 
    1414} 
    1515 
    1616// If multiple 
    17 if($multiple_values == 1) { 
     17if($multiple_values == '1') { 
    1818    echo $this->indent . htmlspecialchars("<?php \$".$this->name."_items =  " . $this->get_field_method . "( '" . $this->name . "' ); ?>")."\n"; 
    1919    echo $this->indent . htmlspecialchars("<?php foreach ( \$".$this->name."_items as \$".$this->name."_item ) { ?>")."\n"; 
  • acf-theme-code/trunk/render/post_object.php

    r1467319 r1474430  
    66 
    77// Check if single or multiple values can be stored 
    8 $multiple_values = $this->settings['multiple']; 
    9 $return_format = $this->settings['return_format']; 
     8// NOTE: Value is a string 
     9$multiple_values = isset( $this->settings['multiple'] ) ? $this->settings['multiple'] : ''; 
    1010 
    11 // If ID and single 
    12 if( $return_format == 'id' && $multiple_values == 0 ) { 
     11// Return format 
     12// NOTE: Not supported by ACF v4 
     13$return_format = isset( $this->settings['return_format'] ) ? $this->settings['return_format'] : ''; 
    1314 
     15// If not object (so ID or Null) and single 
     16if( $return_format != 'object' && $multiple_values == '0' ) { 
    1417    echo $this->indent . htmlspecialchars("<?php \$".$this->name. ' = ' . $this->get_field_method . "( '" . $this->name ."' ); ?>")."\n"; 
    15  
     18    echo $this->indent . htmlspecialchars("<?php // var_dump( \$".$this->name." ); ?>")."\n"; 
    1619} 
    1720 
    18 // If ID and multiple 
    19 if( $return_format == 'id' && $multiple_values == 1 ) { 
    20  
     21// If not object (so ID or Null) and multiple 
     22if( $return_format != 'object' && $multiple_values == '1' ) { 
    2123    echo $this->indent . htmlspecialchars("<?php \$".$this->name.' = ' . $this->get_field_method . "( '" . $this->name ."' ); ?>")."\n"; 
    2224    echo $this->indent . htmlspecialchars("<?php // var_dump( \$".$this->name." ); ?>")."\n"; 
    23  
    2425} 
    2526 
    2627// If object and single 
    27 if( $return_format == 'object' && $multiple_values == 0 ) { 
     28if( $return_format == 'object' && $multiple_values == '0' ) { 
    2829    echo $this->indent . htmlspecialchars("<?php \$post_object = " . $this->get_field_method . "( '" . $this->name . "' ); ?>")."\n"; 
    2930    echo $this->indent . htmlspecialchars("<?php if ( \$post_object ): ?>")."\n"; 
     
    3637 
    3738// If object and multiple 
    38 if( $return_format == 'object' && $multiple_values == 1 ) { 
     39if( $return_format == 'object' && $multiple_values == '1' ) { 
    3940    echo $this->indent . htmlspecialchars("<?php \$post_objects = " . $this->get_field_method . "( '" . $this->name . "' ); ?>")."\n"; 
    4041    echo $this->indent . htmlspecialchars("<?php if ( \$post_objects ): ?>")."\n"; 
  • acf-theme-code/trunk/render/relationship.php

    r1467319 r1474430  
    66 
    77// Get return format 
    8 $return_format = $this->settings['return_format']; 
     8$return_format = isset( $this->settings['return_format'] ) ? $this->settings['return_format'] : ''; 
    99 
    1010// If returned as object 
  • acf-theme-code/trunk/render/select.php

    r1467319 r1474430  
    55 
    66// Check if single or multiple values can be stored 
    7 $multiple_values = $this->settings['multiple']; 
     7// NOTE: value is a string 
     8$multiple_values = isset( $this->settings['multiple'] ) ? $this->settings['multiple'] : ''; 
    89 
    910// Check for return format ACF 5.4 feature 
    10 $return_format = $this->settings['return_format']; 
     11$return_format = isset( $this->settings['return_format'] ) ? $this->settings['return_format'] : ''; 
    1112 
    1213// Dev - uncomment to debug this field 
     
    1415 
    1516// If single 
    16 if($multiple_values == 0) { 
     17if($multiple_values == '0') { 
    1718 
    1819    // if this a single option returned as an array 
     
    3637 
    3738// If multiple 
    38 if($multiple_values == 1) { 
     39if($multiple_values == '1' ) { 
    3940 
    4041    if($return_format == 'array') { 
  • acf-theme-code/trunk/render/taxonomy.php

    r1467319 r1474430  
    66 
    77// Get return format and type 
    8 $return_format = $this->settings['return_format']; 
    9 $taxonomy_field_type = $this->settings['field_type']; 
     8$return_format = isset( $this->settings['return_format'] ) ? $this->settings['return_format'] : ''; 
     9$taxonomy_field_type = isset( $this->settings['field_type'] ) ? $this->settings['field_type'] : ''; 
    1010 
    1111if ( $return_format == 'object' ) { 
  • acf-theme-code/trunk/render/true_false.php

    r1467319 r1474430  
    55if ( ! defined( 'ABSPATH' ) ) exit; 
    66 
    7  
    87echo $this->indent . htmlspecialchars("<?php if ( " . $this->get_field_method . "( '" . $this->name . "' ) == 1 ) { ")."\n"; 
    98echo $this->indent . htmlspecialchars(" // echo 'true'; ")."\n"; 
Note: See TracChangeset for help on using the changeset viewer.