@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * as indicating support for post thumbnails. |
| 17 | 17 | */ |
| 18 | 18 | function lighthouse_setup() { |
| 19 | - // This theme styles the visual editor to resemble the theme style. |
|
| 19 | + // This theme styles the visual editor to resemble the theme style. |
|
| 20 | 20 | $font_url = 'https://fonts.googleapis.com/css?family=Questrial'; |
| 21 | 21 | add_editor_style( |
| 22 | 22 | array( |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Custom template tags for this theme. |
|
| 4 | - * |
|
| 5 | - * Eventually, some of the functionality here could be replaced by core features. |
|
| 6 | - * |
|
| 7 | - * @package Lighthouse |
|
| 8 | - */ |
|
| 3 | + * Custom template tags for this theme. |
|
| 4 | + * |
|
| 5 | + * Eventually, some of the functionality here could be replaced by core features. |
|
| 6 | + * |
|
| 7 | + * @package Lighthouse |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | if ( ! function_exists( 'lighthouse_posted_on' ) ) : |
| 11 | 11 | /** |
@@ -8,11 +8,11 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | function my_acf_settings_path( $path ) {
|
| 10 | 10 | |
| 11 | - // update path |
|
| 12 | - $path = get_stylesheet_directory() . '/includes/acf/'; |
|
| 11 | + // update path |
|
| 12 | + $path = get_stylesheet_directory() . '/includes/acf/'; |
|
| 13 | 13 | |
| 14 | - // return |
|
| 15 | - return $path; |
|
| 14 | + // return |
|
| 15 | + return $path; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | // Customize ACF dir |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | function my_acf_settings_dir( $dir ) {
|
| 22 | 22 | |
| 23 | - // update path |
|
| 24 | - $dir = get_stylesheet_directory_uri() . '/includes/acf/'; |
|
| 23 | + // update path |
|
| 24 | + $dir = get_stylesheet_directory_uri() . '/includes/acf/'; |
|
| 25 | 25 | |
| 26 | - // return |
|
| 27 | - return $dir; |
|
| 26 | + // return |
|
| 27 | + return $dir; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // Save ACF field as JSON |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | function my_acf_json_save_point( $path ) {
|
| 34 | 34 | |
| 35 | - // update path |
|
| 36 | - $path = get_stylesheet_directory() . '/includes/acf-json'; |
|
| 35 | + // update path |
|
| 36 | + $path = get_stylesheet_directory() . '/includes/acf-json'; |
|
| 37 | 37 | |
| 38 | - // return |
|
| 39 | - return $path; |
|
| 38 | + // return |
|
| 39 | + return $path; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // Load ACF field from JSON |
@@ -44,14 +44,14 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | function my_acf_json_load_point( $paths ) {
|
| 46 | 46 | |
| 47 | - // remove original path (optional) |
|
| 48 | - unset($paths[0]); |
|
| 47 | + // remove original path (optional) |
|
| 48 | + unset($paths[0]); |
|
| 49 | 49 | |
| 50 | - // append path |
|
| 51 | - $paths[] = get_stylesheet_directory() . '/includes/acf-json'; |
|
| 50 | + // append path |
|
| 51 | + $paths[] = get_stylesheet_directory() . '/includes/acf-json'; |
|
| 52 | 52 | |
| 53 | - // return |
|
| 54 | - return $paths; |
|
| 53 | + // return |
|
| 54 | + return $paths; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
@@ -263,16 +263,16 @@ discard block |
||
| 263 | 263 | // register post type 'acf-field-group' |
| 264 | 264 | register_post_type('acf-field-group', array( |
| 265 | 265 | 'labels' => array( |
| 266 | - 'name' => __( 'Field Groups', 'acf' ), |
|
| 266 | + 'name' => __( 'Field Groups', 'acf' ), |
|
| 267 | 267 | 'singular_name' => __( 'Field Group', 'acf' ), |
| 268 | - 'add_new' => __( 'Add New' , 'acf' ), |
|
| 269 | - 'add_new_item' => __( 'Add New Field Group' , 'acf' ), |
|
| 270 | - 'edit_item' => __( 'Edit Field Group' , 'acf' ), |
|
| 271 | - 'new_item' => __( 'New Field Group' , 'acf' ), |
|
| 272 | - 'view_item' => __( 'View Field Group', 'acf' ), |
|
| 273 | - 'search_items' => __( 'Search Field Groups', 'acf' ), |
|
| 274 | - 'not_found' => __( 'No Field Groups found', 'acf' ), |
|
| 275 | - 'not_found_in_trash' => __( 'No Field Groups found in Trash', 'acf' ), |
|
| 268 | + 'add_new' => __( 'Add New' , 'acf' ), |
|
| 269 | + 'add_new_item' => __( 'Add New Field Group' , 'acf' ), |
|
| 270 | + 'edit_item' => __( 'Edit Field Group' , 'acf' ), |
|
| 271 | + 'new_item' => __( 'New Field Group' , 'acf' ), |
|
| 272 | + 'view_item' => __( 'View Field Group', 'acf' ), |
|
| 273 | + 'search_items' => __( 'Search Field Groups', 'acf' ), |
|
| 274 | + 'not_found' => __( 'No Field Groups found', 'acf' ), |
|
| 275 | + 'not_found_in_trash' => __( 'No Field Groups found in Trash', 'acf' ), |
|
| 276 | 276 | ), |
| 277 | 277 | 'public' => false, |
| 278 | 278 | 'show_ui' => true, |
@@ -295,16 +295,16 @@ discard block |
||
| 295 | 295 | // register post type 'acf-field' |
| 296 | 296 | register_post_type('acf-field', array( |
| 297 | 297 | 'labels' => array( |
| 298 | - 'name' => __( 'Fields', 'acf' ), |
|
| 298 | + 'name' => __( 'Fields', 'acf' ), |
|
| 299 | 299 | 'singular_name' => __( 'Field', 'acf' ), |
| 300 | - 'add_new' => __( 'Add New' , 'acf' ), |
|
| 301 | - 'add_new_item' => __( 'Add New Field' , 'acf' ), |
|
| 302 | - 'edit_item' => __( 'Edit Field' , 'acf' ), |
|
| 303 | - 'new_item' => __( 'New Field' , 'acf' ), |
|
| 304 | - 'view_item' => __( 'View Field', 'acf' ), |
|
| 305 | - 'search_items' => __( 'Search Fields', 'acf' ), |
|
| 306 | - 'not_found' => __( 'No Fields found', 'acf' ), |
|
| 307 | - 'not_found_in_trash' => __( 'No Fields found in Trash', 'acf' ), |
|
| 300 | + 'add_new' => __( 'Add New' , 'acf' ), |
|
| 301 | + 'add_new_item' => __( 'Add New Field' , 'acf' ), |
|
| 302 | + 'edit_item' => __( 'Edit Field' , 'acf' ), |
|
| 303 | + 'new_item' => __( 'New Field' , 'acf' ), |
|
| 304 | + 'view_item' => __( 'View Field', 'acf' ), |
|
| 305 | + 'search_items' => __( 'Search Fields', 'acf' ), |
|
| 306 | + 'not_found' => __( 'No Fields found', 'acf' ), |
|
| 307 | + 'not_found_in_trash' => __( 'No Fields found in Trash', 'acf' ), |
|
| 308 | 308 | ), |
| 309 | 309 | 'public' => false, |
| 310 | 310 | 'show_ui' => false, |
@@ -413,27 +413,27 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $field_key ); |
| 415 | 415 | |
| 416 | - } |
|
| 416 | + } |
|
| 417 | 417 | |
| 418 | 418 | |
| 419 | - // acf_field_name |
|
| 420 | - if( $field_name = $wp_query->get('acf_field_name') ) { |
|
| 419 | + // acf_field_name |
|
| 420 | + if( $field_name = $wp_query->get('acf_field_name') ) { |
|
| 421 | 421 | |
| 422 | 422 | $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_excerpt = %s", $field_name ); |
| 423 | 423 | |
| 424 | - } |
|
| 424 | + } |
|
| 425 | 425 | |
| 426 | 426 | |
| 427 | - // acf_group_key |
|
| 427 | + // acf_group_key |
|
| 428 | 428 | if( $group_key = $wp_query->get('acf_group_key') ) { |
| 429 | 429 | |
| 430 | 430 | $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $group_key ); |
| 431 | 431 | |
| 432 | - } |
|
| 432 | + } |
|
| 433 | 433 | |
| 434 | 434 | |
| 435 | - // return |
|
| 436 | - return $where; |
|
| 435 | + // return |
|
| 436 | + return $where; |
|
| 437 | 437 | |
| 438 | 438 | } |
| 439 | 439 | |
@@ -11,7 +11,10 @@ discard block |
||
| 11 | 11 | Domain Path: /lang |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 14 | +if( ! defined( 'ABSPATH' ) ) { |
|
| 15 | + exit; |
|
| 16 | +} |
|
| 17 | +// Exit if accessed directly |
|
| 15 | 18 | |
| 16 | 19 | if( ! class_exists('acf') ) : |
| 17 | 20 | |
@@ -168,11 +171,15 @@ discard block |
||
| 168 | 171 | function init() { |
| 169 | 172 | |
| 170 | 173 | // bail early if a plugin called get_field early |
| 171 | - if( !did_action('plugins_loaded') ) return; |
|
| 174 | + if( !did_action('plugins_loaded') ) { |
|
| 175 | + return; |
|
| 176 | + } |
|
| 172 | 177 | |
| 173 | 178 | |
| 174 | 179 | // bail early if already init |
| 175 | - if( acf_get_setting('init') ) return; |
|
| 180 | + if( acf_get_setting('init') ) { |
|
| 181 | + return; |
|
| 182 | + } |
|
| 176 | 183 | |
| 177 | 184 | |
| 178 | 185 | // only run once |
@@ -282,13 +282,13 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | |
| 284 | 284 | // append |
| 285 | - $html .= '<div id="acf-append-show-on-screen" class="acf-hidden">'; |
|
| 286 | - $html .= '<label for="acf-field-key-hide"><input id="acf-field-key-hide" type="checkbox" value="1" name="show_field_keys" ' . $checked . ' /> ' . __('Field Keys','acf') . '</label>'; |
|
| 285 | + $html .= '<div id="acf-append-show-on-screen" class="acf-hidden">'; |
|
| 286 | + $html .= '<label for="acf-field-key-hide"><input id="acf-field-key-hide" type="checkbox" value="1" name="show_field_keys" ' . $checked . ' /> ' . __('Field Keys','acf') . '</label>'; |
|
| 287 | 287 | $html .= '</div>'; |
| 288 | 288 | |
| 289 | 289 | |
| 290 | - // return |
|
| 291 | - return $html; |
|
| 290 | + // return |
|
| 291 | + return $html; |
|
| 292 | 292 | |
| 293 | 293 | } |
| 294 | 294 | |
@@ -396,9 +396,9 @@ discard block |
||
| 396 | 396 | // only save once! WordPress save's a revision as well. |
| 397 | 397 | if( wp_is_post_revision($post_id) ) { |
| 398 | 398 | |
| 399 | - return $post_id; |
|
| 399 | + return $post_id; |
|
| 400 | 400 | |
| 401 | - } |
|
| 401 | + } |
|
| 402 | 402 | |
| 403 | 403 | |
| 404 | 404 | // verify nonce |
@@ -409,11 +409,11 @@ discard block |
||
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | |
| 412 | - // disable local to avoid conflicts between DB and local |
|
| 412 | + // disable local to avoid conflicts between DB and local |
|
| 413 | 413 | acf_disable_local(); |
| 414 | 414 | |
| 415 | 415 | |
| 416 | - // save fields |
|
| 416 | + // save fields |
|
| 417 | 417 | unset( $_POST['acf_fields']['acfcloneindex'] ); |
| 418 | 418 | |
| 419 | 419 | if( !empty($_POST['acf_fields']) ) { |
@@ -453,10 +453,10 @@ discard block |
||
| 453 | 453 | |
| 454 | 454 | |
| 455 | 455 | // delete fields |
| 456 | - if( $_POST['_acf_delete_fields'] ) { |
|
| 456 | + if( $_POST['_acf_delete_fields'] ) { |
|
| 457 | 457 | |
| 458 | - $ids = explode('|', $_POST['_acf_delete_fields']); |
|
| 459 | - $ids = array_map( 'intval', $ids ); |
|
| 458 | + $ids = explode('|', $_POST['_acf_delete_fields']); |
|
| 459 | + $ids = array_map( 'intval', $ids ); |
|
| 460 | 460 | |
| 461 | 461 | foreach( $ids as $id ) { |
| 462 | 462 | |
@@ -468,20 +468,20 @@ discard block |
||
| 468 | 468 | |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - } |
|
| 471 | + } |
|
| 472 | 472 | |
| 473 | 473 | |
| 474 | 474 | // add args |
| 475 | - $_POST['acf_field_group']['ID'] = $post_id; |
|
| 476 | - $_POST['acf_field_group']['title'] = $_POST['post_title']; |
|
| 475 | + $_POST['acf_field_group']['ID'] = $post_id; |
|
| 476 | + $_POST['acf_field_group']['title'] = $_POST['post_title']; |
|
| 477 | 477 | |
| 478 | 478 | |
| 479 | 479 | // save field group |
| 480 | - acf_update_field_group( $_POST['acf_field_group'] ); |
|
| 480 | + acf_update_field_group( $_POST['acf_field_group'] ); |
|
| 481 | 481 | |
| 482 | 482 | |
| 483 | - // return |
|
| 484 | - return $post_id; |
|
| 483 | + // return |
|
| 484 | + return $post_id; |
|
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | |
@@ -568,8 +568,8 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - // status |
|
| 572 | - } elseif( $column == 'acf-fg-status' ) { |
|
| 571 | + // status |
|
| 572 | + } elseif( $column == 'acf-fg-status' ) { |
|
| 573 | 573 | |
| 574 | 574 | if( isset($this->sync[ $field_group['key'] ]) ) { |
| 575 | 575 | |
@@ -587,12 +587,12 @@ discard block |
||
| 587 | 587 | |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | - // fields |
|
| 591 | - } elseif( $column == 'acf-fg-count' ) { |
|
| 590 | + // fields |
|
| 591 | + } elseif( $column == 'acf-fg-count' ) { |
|
| 592 | 592 | |
| 593 | 593 | echo acf_get_field_count( $field_group ); |
| 594 | 594 | |
| 595 | - } |
|
| 595 | + } |
|
| 596 | 596 | |
| 597 | 597 | } |
| 598 | 598 | |
@@ -79,17 +79,17 @@ |
||
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | // load json |
| 82 | - $request = wp_remote_post( 'http://assets.advancedcustomfields.com/add-ons/add-ons.json' ); |
|
| 83 | - |
|
| 84 | - // validate |
|
| 85 | - if( is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) |
|
| 86 | - { |
|
| 87 | - acf_add_admin_notice(__('<b>Error</b>. Could not load add-ons list', 'acf'), 'error'); |
|
| 88 | - } |
|
| 89 | - else |
|
| 90 | - { |
|
| 91 | - $this->view['json'] = json_decode( $request['body'], true ); |
|
| 92 | - } |
|
| 82 | + $request = wp_remote_post( 'http://assets.advancedcustomfields.com/add-ons/add-ons.json' ); |
|
| 83 | + |
|
| 84 | + // validate |
|
| 85 | + if( is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) |
|
| 86 | + { |
|
| 87 | + acf_add_admin_notice(__('<b>Error</b>. Could not load add-ons list', 'acf'), 'error'); |
|
| 88 | + } |
|
| 89 | + else |
|
| 90 | + { |
|
| 91 | + $this->view['json'] = json_decode( $request['body'], true ); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | 94 | } |
| 95 | 95 | |
@@ -85,8 +85,7 @@ |
||
| 85 | 85 | if( is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) |
| 86 | 86 | { |
| 87 | 87 | acf_add_admin_notice(__('<b>Error</b>. Could not load add-ons list', 'acf'), 'error'); |
| 88 | - } |
|
| 89 | - else |
|
| 88 | + } else |
|
| 90 | 89 | { |
| 91 | 90 | $this->view['json'] = json_decode( $request['body'], true ); |
| 92 | 91 | } |
@@ -222,41 +222,41 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | |
| 224 | 224 | // validate json |
| 225 | - if( empty($json) ) { |
|
| 225 | + if( empty($json) ) { |
|
| 226 | 226 | |
| 227 | - acf_add_admin_notice(__('Import file empty', 'acf'), 'error'); |
|
| 228 | - return; |
|
| 227 | + acf_add_admin_notice(__('Import file empty', 'acf'), 'error'); |
|
| 228 | + return; |
|
| 229 | 229 | |
| 230 | - } |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | 232 | |
| 233 | - // if importing an auto-json, wrap field group in array |
|
| 234 | - if( isset($json['key']) ) { |
|
| 233 | + // if importing an auto-json, wrap field group in array |
|
| 234 | + if( isset($json['key']) ) { |
|
| 235 | 235 | |
| 236 | - $json = array( $json ); |
|
| 236 | + $json = array( $json ); |
|
| 237 | 237 | |
| 238 | - } |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | 240 | |
| 241 | - // vars |
|
| 242 | - $added = array(); |
|
| 243 | - $ignored = array(); |
|
| 244 | - $ref = array(); |
|
| 245 | - $order = array(); |
|
| 241 | + // vars |
|
| 242 | + $added = array(); |
|
| 243 | + $ignored = array(); |
|
| 244 | + $ref = array(); |
|
| 245 | + $order = array(); |
|
| 246 | 246 | |
| 247 | - foreach( $json as $field_group ) { |
|
| 247 | + foreach( $json as $field_group ) { |
|
| 248 | 248 | |
| 249 | - // check if field group exists |
|
| 250 | - if( acf_get_field_group($field_group['key'], true) ) { |
|
| 249 | + // check if field group exists |
|
| 250 | + if( acf_get_field_group($field_group['key'], true) ) { |
|
| 251 | 251 | |
| 252 | - // append to ignored |
|
| 253 | - $ignored[] = $field_group['title']; |
|
| 254 | - continue; |
|
| 252 | + // append to ignored |
|
| 253 | + $ignored[] = $field_group['title']; |
|
| 254 | + continue; |
|
| 255 | 255 | |
| 256 | - } |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | 258 | |
| 259 | - // remove fields |
|
| 259 | + // remove fields |
|
| 260 | 260 | $fields = acf_extract_var($field_group, 'fields'); |
| 261 | 261 | |
| 262 | 262 | |
@@ -314,27 +314,27 @@ discard block |
||
| 314 | 314 | // append to added |
| 315 | 315 | $added[] = '<a href="' . admin_url("post.php?post={$field_group['ID']}&action=edit") . '" target="_blank">' . $field_group['title'] . '</a>'; |
| 316 | 316 | |
| 317 | - } |
|
| 317 | + } |
|
| 318 | 318 | |
| 319 | 319 | |
| 320 | - // messages |
|
| 321 | - if( !empty($added) ) { |
|
| 320 | + // messages |
|
| 321 | + if( !empty($added) ) { |
|
| 322 | 322 | |
| 323 | - $message = __('<b>Success</b>. Import tool added %s field groups: %s', 'acf'); |
|
| 324 | - $message = sprintf( $message, count($added), implode(', ', $added) ); |
|
| 323 | + $message = __('<b>Success</b>. Import tool added %s field groups: %s', 'acf'); |
|
| 324 | + $message = sprintf( $message, count($added), implode(', ', $added) ); |
|
| 325 | 325 | |
| 326 | - acf_add_admin_notice( $message ); |
|
| 326 | + acf_add_admin_notice( $message ); |
|
| 327 | 327 | |
| 328 | - } |
|
| 328 | + } |
|
| 329 | 329 | |
| 330 | - if( !empty($ignored) ) { |
|
| 330 | + if( !empty($ignored) ) { |
|
| 331 | 331 | |
| 332 | - $message = __('<b>Warning</b>. Import tool detected %s field groups already exist and have been ignored: %s', 'acf'); |
|
| 333 | - $message = sprintf( $message, count($ignored), implode(', ', $ignored) ); |
|
| 332 | + $message = __('<b>Warning</b>. Import tool detected %s field groups already exist and have been ignored: %s', 'acf'); |
|
| 333 | + $message = sprintf( $message, count($ignored), implode(', ', $ignored) ); |
|
| 334 | 334 | |
| 335 | - acf_add_admin_notice( $message, 'error' ); |
|
| 335 | + acf_add_admin_notice( $message, 'error' ); |
|
| 336 | 336 | |
| 337 | - } |
|
| 337 | + } |
|
| 338 | 338 | |
| 339 | 339 | |
| 340 | 340 | } |
@@ -436,7 +436,9 @@ |
||
| 436 | 436 | |
| 437 | 437 | |
| 438 | 438 | // validate field group |
| 439 | - if( empty($field_group) ) continue; |
|
| 439 | + if( empty($field_group) ) { |
|
| 440 | + continue; |
|
| 441 | + } |
|
| 440 | 442 | |
| 441 | 443 | |
| 442 | 444 | // load fields |
@@ -12,7 +12,9 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if( !defined('ABSPATH') ) exit; |
|
| 15 | +if( !defined('ABSPATH') ) { |
|
| 16 | + exit; |
|
| 17 | +} |
|
| 16 | 18 | |
| 17 | 19 | |
| 18 | 20 | // global |