| |
| <?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| defined( 'ABSPATH' ) || exit;
|
|
|
| add_action( 'acf/init', function() {
|
| if ( ! function_exists( 'acf_add_local_field_group' ) ) {
|
| return;
|
| }
|
|
|
| acf_add_local_field_group( array(
|
| 'key' => 'group_wpcode_snippets_sync',
|
| 'title' => 'WPCode Snippet Data',
|
| 'fields' => array(
|
|
|
|
|
|
|
|
|
| array(
|
| 'key' => 'field_tab_snippet_overview',
|
| 'label' => 'Snippet Overview',
|
| 'name' => '',
|
| 'type' => 'tab',
|
| 'placement' => 'top',
|
| 'endpoint' => 0,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_original_wpcode_id',
|
| 'label' => 'Original WPCode Snippet ID',
|
| 'name' => 'original_wpcode_id',
|
| 'type' => 'text',
|
| 'instructions' => 'The ID from the actual wpcode post type',
|
| 'required' => 1,
|
| 'wrapper' => array( 'width' => '25' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_kic_snippet_id',
|
| 'label' => 'KIC Snippet ID',
|
| 'name' => 'kic_snippet_id',
|
| 'type' => 'text',
|
| 'instructions' => 'Universal identifier: wpcode_{ID}',
|
| 'required' => 0,
|
| 'wrapper' => array( 'width' => '25' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_active',
|
| 'label' => 'Active',
|
| 'name' => 'snippet_active',
|
| 'type' => 'true_false',
|
| 'instructions' => 'Is this snippet active in WPCode?',
|
| 'ui' => 1,
|
| 'wrapper' => array( 'width' => '25' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_last_sync_time',
|
| 'label' => 'Last Synced',
|
| 'name' => 'last_sync_time',
|
| 'type' => 'date_time_picker',
|
| 'instructions' => 'When this snippet was last synced',
|
| 'display_format' => 'M j, Y g:i a',
|
| 'return_format' => 'Y-m-d H:i:s',
|
| 'wrapper' => array( 'width' => '25' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
|
|
|
|
| array(
|
| 'key' => 'field_tab_code',
|
| 'label' => 'Code & Type',
|
| 'name' => '',
|
| 'type' => 'tab',
|
| 'placement' => 'top',
|
| 'endpoint' => 0,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_title',
|
| 'label' => 'Snippet Name',
|
| 'name' => 'snippet_title',
|
| 'type' => 'text',
|
| 'instructions' => 'Name of the snippet from WPCode',
|
| 'wrapper' => array( 'width' => '100' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_code',
|
| 'label' => 'Code',
|
| 'name' => 'snippet_code',
|
| 'type' => 'textarea',
|
| 'instructions' => 'The actual code content (text area)',
|
| 'rows' => 10,
|
| 'wrapper' => array( 'width' => '100' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_code_file',
|
| 'label' => 'Code File (Download)',
|
| 'name' => 'snippet_code_file',
|
| 'type' => 'file',
|
| 'instructions' => 'Downloadable code file - automatically generated from snippet code',
|
| 'return_format' => 'array',
|
| 'library' => 'all',
|
| 'mime_types' => 'txt,php,js,css,html',
|
| 'wrapper' => array( 'width' => '100' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_type',
|
| 'label' => 'Code Type',
|
| 'name' => 'snippet_type',
|
| 'type' => 'select',
|
| 'choices' => array(
|
| 'php' => 'PHP',
|
| 'html' => 'HTML',
|
| 'css' => 'CSS',
|
| 'js' => 'JavaScript',
|
| 'text' => 'Text',
|
| ),
|
| 'wrapper' => array( 'width' => '33' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_location',
|
| 'label' => 'Auto Insert Location',
|
| 'name' => 'snippet_location',
|
| 'type' => 'text',
|
| 'wrapper' => array( 'width' => '33' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_priority',
|
| 'label' => 'Priority',
|
| 'name' => 'snippet_priority',
|
| 'type' => 'number',
|
| 'default_value' => 10,
|
| 'wrapper' => array( 'width' => '34' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
|
|
|
|
| array(
|
| 'key' => 'field_tab_targeting',
|
| 'label' => 'Targeting & Scheduling',
|
| 'name' => '',
|
| 'type' => 'tab',
|
| 'placement' => 'top',
|
| 'endpoint' => 0,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_auto_insert',
|
| 'label' => 'Auto Insert Enabled',
|
| 'name' => 'snippet_auto_insert',
|
| 'type' => 'true_false',
|
| 'ui' => 1,
|
| 'wrapper' => array( 'width' => '25' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_device_type',
|
| 'label' => 'Device Type',
|
| 'name' => 'snippet_device_type',
|
| 'type' => 'select',
|
| 'choices' => array(
|
| 'all' => 'All Devices',
|
| 'mobile' => 'Mobile Only',
|
| 'desktop' => 'Desktop Only',
|
| ),
|
| 'default_value' => 'all',
|
| 'wrapper' => array( 'width' => '25' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_schedule_start',
|
| 'label' => 'Schedule Start',
|
| 'name' => 'snippet_schedule_start',
|
| 'type' => 'date_time_picker',
|
| 'display_format' => 'M j, Y g:i a',
|
| 'return_format' => 'Y-m-d H:i:s',
|
| 'wrapper' => array( 'width' => '25' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_schedule_end',
|
| 'label' => 'Schedule End',
|
| 'name' => 'snippet_schedule_end',
|
| 'type' => 'date_time_picker',
|
| 'display_format' => 'M j, Y g:i a',
|
| 'return_format' => 'Y-m-d H:i:s',
|
| 'wrapper' => array( 'width' => '25' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
|
|
|
|
| array(
|
| 'key' => 'field_tab_metadata',
|
| 'label' => 'Metadata',
|
| 'name' => '',
|
| 'type' => 'tab',
|
| 'placement' => 'top',
|
| 'endpoint' => 0,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_tags',
|
| 'label' => 'Tags',
|
| 'name' => 'snippet_tags',
|
| 'type' => 'text',
|
| 'instructions' => 'Comma-separated tags',
|
| 'wrapper' => array( 'width' => '50' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_description',
|
| 'label' => 'Description',
|
| 'name' => 'snippet_description',
|
| 'type' => 'textarea',
|
| 'rows' => 3,
|
| 'wrapper' => array( 'width' => '50' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_dependencies',
|
| 'label' => 'Dependencies',
|
| 'name' => 'snippet_dependencies',
|
| 'type' => 'textarea',
|
| 'instructions' => 'List snippets this code depends on (comma-separated names or IDs)',
|
| 'rows' => 3,
|
| 'wrapper' => array( 'width' => '100' ),
|
| 'readonly' => 0,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_created_date',
|
| 'label' => 'Created Date',
|
| 'name' => 'snippet_created_date',
|
| 'type' => 'date_time_picker',
|
| 'display_format' => 'M j, Y g:i a',
|
| 'return_format' => 'Y-m-d H:i:s',
|
| 'wrapper' => array( 'width' => '33' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_modified_date',
|
| 'label' => 'Modified Date',
|
| 'name' => 'snippet_modified_date',
|
| 'type' => 'date_time_picker',
|
| 'display_format' => 'M j, Y g:i a',
|
| 'return_format' => 'Y-m-d H:i:s',
|
| 'wrapper' => array( 'width' => '33' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_author',
|
| 'label' => 'Author',
|
| 'name' => 'snippet_author',
|
| 'type' => 'text',
|
| 'wrapper' => array( 'width' => '50' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
|
|
| array(
|
| 'key' => 'field_snippet_version',
|
| 'label' => 'Snippet Version',
|
| 'name' => 'snippet_version',
|
| 'type' => 'text',
|
| 'instructions' => 'Version number from WPCode',
|
| 'wrapper' => array( 'width' => '50' ),
|
| 'readonly' => 1,
|
| ),
|
|
|
| ),
|
| 'location' => array(
|
| array(
|
| array(
|
| 'param' => 'post_type',
|
| 'operator' => '==',
|
| 'value' => 'wpcode_snippets_sync',
|
| ),
|
| ),
|
| ),
|
| 'menu_order' => 0,
|
| 'position' => 'normal',
|
| 'style' => 'default',
|
| 'label_placement' => 'top',
|
| 'instruction_placement' => 'label',
|
| 'active' => true,
|
| 'show_in_rest' => 1,
|
| ) );
|
| } );
|
| |
| |
Comments