Skip to content

Instantly share code, notes, and snippets.

@shereewalker
Created December 14, 2020 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shereewalker/48d699a722f404cc55e73cf22bf49c54 to your computer and use it in GitHub Desktop.
Save shereewalker/48d699a722f404cc55e73cf22bf49c54 to your computer and use it in GitHub Desktop.
<?php
/*
Title: Work options
Post Type: work
*/
$args = [
'taxonomy' => 'work_category',
'hide_empty' => false,
];
$work_categories = get_terms( $args );
// Get list of all pages
$pages = get_posts( array(
'post_type' => 'page',
'orderby' => 'post_title',
'order' => 'ASC',
'numberposts' => -1
));
$posts = get_posts(
array(
'order' => 'DESC',
'orderby' => 'post_date',
'post_type' => 'post',
'hide_empty' => false,
'numberposts' => 50
)
);
piklist( 'field', array(
'type' => 'date',
'field' => 'az_work_release_date',
'label' => 'Release date',
'value' => '',
'help' => '',
) );
piklist( 'field', array(
'type' => 'editor',
'field' => 'az_work_intro',
'label' => 'Introduction',
'value' => '',
'help' => '',
'attributes' => array( 'class' => 'large-text' ),
'options' => array (
'media_buttons' => true,
'teeny' => true,
'dfw' => true,
'tinymce' => true,
'quicktags' => true
),
) );
piklist( 'field', array(
'type' => 'text',
'field' => 'az_work_conclusion_heading',
'label' => 'Conclusion heading',
'value' => '',
'help' => '',
'attributes' => array( 'class' => 'large-text' ),
'columns' => 12,
'options' => array (
'media_buttons' => true,
'teeny' => true,
'dfw' => true,
'tinymce' => true,
'quicktags' => true
),
) );
piklist( 'field', array(
'type' => 'editor',
'field' => 'az_work_conclusion_paragraph_1',
'label' => 'Conclusion (Paragraph 1)',
'value' => '',
'help' => '',
'attributes' => array( 'class' => 'large-text' ),
'columns' => 12,
'options' => array (
'media_buttons' => true,
'teeny' => true,
'dfw' => true,
'tinymce' => true,
'quicktags' => true
),
) );
piklist( 'field', array(
'type' => 'editor',
'field' => 'az_work_conclusion_paragraph_2',
'label' => 'Conclusion (Paragraph 2)',
'value' => '',
'help' => '',
'attributes' => array( 'class' => 'large-text' ),
'columns' => 12,
'options' => array (
'media_buttons' => true,
'teeny' => true,
'dfw' => true,
'tinymce' => true,
'quicktags' => true
),
) );
piklist('field', array(
'type' => 'group',
'field' => 'az_work_text_and_image_group',
'label' => __('Text and Image section', 'az'),
'columns' => '12',
'add_more' => true,
'fields' => array(
// Heading
array(
'type' => 'text',
'field' => 'az_work_text_and_image_heading',
'label' => 'Heading',
'value' => '',
),
// Content
array(
'type' => 'editor',
'field' => 'az_work_text_and_image_content',
'label' => 'Content',
'value' => '',
'help' => '',
'attributes' => array( 'class' => 'large-text' ),
'options' => array (
'media_buttons' => true,
'teeny' => true,
'dfw' => true,
'tinymce' => true,
'quicktags' => true
),
),
// Image
array(
'type' => 'file',
'field' => 'az_work_text_and_image_image',
'label' => 'Image',
'value' => '',
'options' => array(
'multiple' => false
)
),
)
));
piklist( 'field', array(
'type' => 'radio',
'scope' => 'post_meta',
'field' => 'az_work_latest_work_category',
'columns' => '12',
'label' => 'Pick the example of work you would like to display on this work page',
'choices' => piklist(
$work_categories,
array(
'term_id',
'name'
)
),
) );
piklist( 'field', array(
'type' => 'text',
'scope' => 'post_meta',
'field' => 'az_work_related_pages_group_heading',
'columns' => '12',
'label' => 'Heading for the pages related to this Work item section',
) );
piklist('field', array(
'type' => 'group',
'field' => 'az_work_related_pages_group',
'label' => __('Pick the pages related to this Work item', 'az'),
'columns' => '12',
'add_more' => true,
'fields' => array(
// Page
array(
'type' => 'select',
'scope' => 'post_meta',
'field' => 'az_work_related_pages_page',
'columns' => '12',
'label' => 'Pick a page',
'choices' => piklist(
$pages,
array(
'ID',
'post_title'
)
),
)
)
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment