A man either lives life as it happens to him, meets it head-on and licks it, or he turns his back on it and starts to wither away. — Dr. Boyce, advising Pike against retirement, “The Menagerie” (“The Cage”), stardate unknown

Load archive options

Filed in Uncategorized Leave a comment

// Create post type options for archives section on theme options page
function acf_load_post_type_groups( $field ) {

$checked_post_types = get_checked_post_types();

$field[‘sub_fields’] = array();

$array = array(
‘key’ => ‘field_post’,
‘label’ => ‘Regular Posts (WP Core)’,
‘name’ => ‘posts’,
‘type’ => ‘group’,
‘sub_fields’ => array(
array(
‘key’ => ‘sub_field_hf8d7fhr62tr’,
‘label’ => ‘Layout’,
‘name’ => ‘layout_post’,
‘type’ => ‘radio’,
‘instructions’ => ”,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ”,
‘id’ => ”,
),
‘choices’ => array(
‘left_sidebar’ => ‘Left sidebar’,
‘right_sidebar’ => ‘Right sidebar’,
‘no_sidebar’ => ‘No sidebar (full-width)’,
),
‘allow_null’ => 0,
‘other_choice’ => 0,
‘default_value’ => ‘right_sidebar’,
‘layout’ => ‘vertical’,
‘return_format’ => ‘value’,
‘save_other_choice’ => 0,
),
array(
‘key’ => ‘sub_field_oh5g342uyt79hf’,
‘label’ => ‘Appearance’,
‘name’ => ‘appearance_post’,
‘type’ => ‘select’,
‘instructions’ => ‘Choose how archive lists should appear, as a vertical list or a card grid.’,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ‘input-10’,
‘id’ => ”,
),
‘choices’ => array(
‘list’ => ‘Vertical List’,
‘grid’ => ‘Card Grid’,
),
‘default_value’ => ‘list’,
‘allow_null’ => 0,
‘multiple’ => 0,
‘ui’ => 0,
‘return_format’ => ‘value’,
‘ajax’ => 0,
‘placeholder’ => ”,
),
array(
‘key’ => ‘sub_field_jdud8d746lh0jhf’,
‘label’ => ‘Metadata’,
‘name’ => ‘metadata_post’,
‘type’ => ‘group’,
‘instructions’ => ‘Show tags and/or categories on archive pages and/or single posts.’,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ‘input-10’,
‘id’ => ”,
),
‘layout’ => ‘block’,
‘acfe_seamless_style’ => 1,
‘acfe_group_modal’ => 0,
‘sub_fields’ => array(
array(
‘key’ => ‘sub_field_hff8f7k5kk0n2’,
‘label’ => ”,
‘name’ => ”,
‘type’ => ‘checkbox’,
‘instructions’ => ”,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ”,
‘id’ => ”,
),
‘choices’ => array(
‘tags’ => ‘Tags’,
‘categories’ => ‘Categories’,
‘archives’ => ‘On archive pages’,
‘single’ => ‘On single posts’,
‘labels’ => ‘Text labels’,
‘icons’ => ‘Icons’,
),
‘allow_custom’ => 0,
‘default_value’ => array(
),
‘layout’ => ‘vertical’,
‘toggle’ => 0,
‘return_format’ => ‘value’,
‘save_custom’ => 0,
),
),
),
array(
‘key’ => ‘sub_field_kg9s44se2hhh7’,
‘label’ => ‘Excerpts’,
‘name’ => ‘excerpt_length_post’,
‘type’ => ‘number’,
‘instructions’ => ‘Enter the length of excerpts (in number of characters).’,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ‘input-8’,
‘id’ => ”,
),
‘default_value’ => 180,
‘placeholder’ => ”,
‘prepend’ => ”,
‘append’ => ”,
‘min’ => ”,
‘max’ => ”,
‘step’ => ”,
),
),
);

$field[‘sub_fields’][] = $array;

foreach($checked_post_types as $checked_post_type) {

$array = array(
‘key’ => ‘field_’ . strtolower(str_replace(‘ ‘, ‘-‘, $checked_post_type)),
‘label’ => ucwords(str_replace(‘_’, ‘ ‘, $checked_post_type)),
‘name’ => $checked_post_type,
‘type’ => ‘group’,
‘sub_fields’ => array(
array(
‘key’ => ‘field_’ . strtolower(str_replace(‘ ‘, ‘-‘, $checked_post_type)),
‘label’ => ‘Layout’,
‘name’ => ‘layout_’ . strtolower(str_replace(‘ ‘, ‘-‘, $checked_post_type)),
‘type’ => ‘radio’,
‘instructions’ => ”,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ”,
‘id’ => ”,
),
‘choices’ => array(
‘left_sidebar’ => ‘Left sidebar’,
‘right_sidebar’ => ‘Right sidebar’,
‘no_sidebar’ => ‘No sidebar (full-width)’,
),
‘allow_null’ => 0,
‘other_choice’ => 0,
‘default_value’ => ‘right_sidebar’,
‘layout’ => ‘vertical’,
‘return_format’ => ‘value’,
‘save_other_choice’ => 0,
),
array(
‘key’ => ‘field_’ . strtolower(str_replace(‘ ‘, ‘-‘, $checked_post_type)),
‘label’ => ‘Appearance’,
‘name’ => ‘appearance_’ . strtolower(str_replace(‘ ‘, ‘-‘, $checked_post_type)),
‘type’ => ‘select’,
‘instructions’ => ‘Choose how archive lists should appear, as a vertical list or a card grid.’,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ‘input-10’,
‘id’ => ”,
),
‘choices’ => array(
‘list’ => ‘Vertical List’,
‘grid’ => ‘Card Grid’,
),
‘default_value’ => ‘list’,
‘allow_null’ => 0,
‘multiple’ => 0,
‘ui’ => 0,
‘return_format’ => ‘value’,
‘ajax’ => 0,
‘placeholder’ => ”,
),
array(
‘key’ => ‘field_’ . strtolower(str_replace(‘ ‘, ‘-‘, $checked_post_type)),
‘label’ => ‘Metadata’,
‘name’ => ‘metadata_’ . strtolower(str_replace(‘ ‘, ‘-‘, $checked_post_type)),
‘type’ => ‘group’,
‘instructions’ => ‘Show tags and/or categories on archive pages and/or single posts.’,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ‘input-10’,
‘id’ => ”,
),
‘layout’ => ‘block’,
‘acfe_seamless_style’ => 1,
‘acfe_group_modal’ => 0,
‘sub_fields’ => array(
array(
‘key’ => ‘field_metadata_choices_’ . strtolower(str_replace(‘ ‘, ‘-‘, $checked_post_type)),
‘label’ => ”,
‘name’ => ‘metadata_choices_’ . strtolower(str_replace(‘ ‘, ‘-‘, $checked_post_type)),
‘type’ => ‘checkbox’,
‘instructions’ => ”,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ”,
‘id’ => ”,
),
‘choices’ => array(
‘tags’ => ‘Tags’,
‘categories’ => ‘Categories’,
‘archives’ => ‘On archive pages’,
‘single’ => ‘On single posts’,
‘labels’ => ‘Text labels’,
‘icons’ => ‘Icons’,
),
‘allow_custom’ => 0,
‘default_value’ => array(
),
‘layout’ => ‘vertical’,
‘toggle’ => 0,
‘return_format’ => ‘value’,
‘save_custom’ => 0,
),
),
),
array(
‘key’ => ‘field_’ . strtolower(str_replace(‘ ‘, ‘-‘, $checked_post_type)),
‘label’ => ‘Excerpts’,
‘name’ => ‘excerpt_length_’ . strtolower(str_replace(‘ ‘, ‘-‘, $checked_post_type)),
‘type’ => ‘number’,
‘instructions’ => ‘Enter the length of excerpts (in number of characters).’,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ‘input-8’,
‘id’ => ”,
),
‘default_value’ => 180,
‘placeholder’ => ”,
‘prepend’ => ”,
‘append’ => ”,
‘min’ => ”,
‘max’ => ”,
‘step’ => ”,
),
),

);

$field[‘sub_fields’][] = $array;

}

return $field;

}
add_filter(‘acf/load_field/key=field_604de6ee3ffc6’, ‘acf_load_post_type_groups’);

Hello world!

Filed in Uncategorized 1 Comment

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!