public function create_post_type()
 {
     if (!isset($_GET['post_type'])) {
         $post_id = isset($_GET['post']) ? $_GET['post'] : 0;
         $page = get_post_type($post_id);
     } else {
         $page = $_GET['post_type'];
     }
     $p = register_cuztom_post_type($page);
     foreach ($this->data as $key => $value) {
         if ($key == "" || (!is_array($this->data[$key]['post_type']) || !isset($this->data[$key]['post_type']))) {
             continue;
         }
         foreach ($this->data[$key]['post_type'] as $key1 => $value1) {
             if ($value1 != $page) {
                 continue;
             }
             $array = array_values($this->data[$key]['fields']);
             $p->add_meta_box($this->data[$key]['index'], esc_html__($this->data[$key]['label']), $array);
         }
     }
 }
Ejemplo n.º 2
0
 public function hackgov_post_types()
 {
     $this->cpt_post = register_cuztom_post_type('Post');
     $this->cpt_post->add_meta_box('post', 'Recommendation', array(array('name' => 'recommendation', 'label' => 'Recommendation', 'description' => 'Recommendation content', 'type' => 'wysiwyg')));
     $this->cpt_post->add_meta_box('category', 'Recommendation', array(array('name' => 'status', 'label' => 'Status', 'description' => 'Problem Status', 'type' => 'select', 'options' => hackgov_status()), array('name' => 'category', 'label' => 'Category', 'description' => 'Category problem', 'type' => 'radios', 'options' => hackgov_category()), array('name' => 'priority', 'label' => 'Priority', 'description' => 'Priority problem', 'type' => 'radios', 'options' => hackgov_priority())), 'side');
     // // register custom post status
     // register_post_status( 'nothing', array(
     // 	'label'                     => _x( 'Nothing', 'post' ),
     // 	'public'                    => true,
     // 	'exclude_from_search'       => false,
     // 	'show_in_admin_all_list'    => true,
     // 	'show_in_admin_status_list' => true,
     // 	'label_count'               => _n_noop( 'Nothing <span class="count">(%s)</span>', 'Nothing <span class="count">(%s)</span>' ),
     // ) );
     // // register custom post status
     // register_post_status( 'on-going', array(
     // 	'label'                     => _x( 'On Going', 'post' ),
     // 	'public'                    => true,
     // 	'exclude_from_search'       => false,
     // 	'show_in_admin_all_list'    => true,
     // 	'show_in_admin_status_list' => true,
     // 	'label_count'               => _n_noop( 'On Going <span class="count">(%s)</span>', 'On Going <span class="count">(%s)</span>' ),
     // ) );
     // // register custom post status
     // register_post_status( 'resolved', array(
     // 	'label'                     => _x( 'Resolved', 'post' ),
     // 	'public'                    => true,
     // 	'exclude_from_search'       => false,
     // 	'show_in_admin_all_list'    => true,
     // 	'show_in_admin_status_list' => true,
     // 	'label_count'               => _n_noop( 'Resolved <span class="count">(%s)</span>', 'Resolved <span class="count">(%s)</span>' ),
     // ) );
     // remove post tag and category
     register_taxonomy('category', array());
     register_taxonomy('post_tag', array());
 }
Ejemplo n.º 3
0
<?php

//Create team custom post type
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-universal-access', 'supports' => array('title', 'editor'));
$faq = register_cuztom_post_type('faq', $args);
Ejemplo n.º 4
0
<?php

//Gallery CPT
$args = array('has_archive' => true, 'hierarchical' => true, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-phone', 'supports' => array('title'));
$contact = register_cuztom_post_type('Contact', $args);
$contact->add_meta_box('contact', 'Contact', array('bundle', array(array('name' => 'photo', 'label' => 'Picture', 'description' => '1:1 Ratio', 'type' => 'image'), array('name' => 'heading', 'label' => 'Heading', 'description' => '', 'type' => 'text'), array('name' => 'text', 'label' => 'Content', 'description' => '', 'type' => 'wysiwyg'), array('name' => 'email', 'label' => 'Email', 'description' => '', 'type' => 'text'), array('name' => 'emailtext', 'label' => 'Email Button Text', 'description' => '', 'type' => 'text'), array('name' => 'phone', 'label' => 'Phone', 'description' => '', 'type' => 'text'), array('name' => 'displayphone', 'label' => 'Phone Display Text', 'description' => '', 'type' => 'text'))));
Ejemplo n.º 5
0
<?php

//Gallery CPT
$args = array('has_archive' => true, 'hierarchical' => true, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-format-gallery', 'supports' => array('title'));
$slide = register_cuztom_post_type('Gallery', $args);
$slide->add_meta_box('slide', 'Slide', array('bundle', array(array('name' => 'image', 'label' => 'Slide Image', 'description' => 'Dimensions 1200px x 800px', 'type' => 'image'), array('name' => 'headline', 'label' => 'Headline', 'description' => '', 'type' => 'textarea'), array('name' => 'text', 'label' => 'Content', 'description' => '', 'type' => 'textarea'), array('name' => 'url', 'label' => 'Link', 'description' => 'Link for "Find out More" button. <br>Example: http://www.google.ca', 'type' => 'text'))));
Ejemplo n.º 6
0
<?php

//Connect CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-format-image', 'supports' => array('title', 'editor'));
$guide = register_cuztom_post_type('Logo', $args);
$guide->add_meta_box('logo', 'Logo Package', array(array('name' => 'logo_1', 'label' => 'Primary Logo', 'description' => 'Choose primary logo', 'type' => 'image'), array('name' => 'logo_2', 'label' => 'Secondary Logo', 'description' => 'Choose secondary logo', 'type' => 'image'), array('name' => 'upload', 'label' => 'Logo Download File', 'description' => 'Upload logo package (.zip)', 'type' => 'file'), array('name' => 'label', 'label' => 'Label for download link', 'description' => ' ex. _______ Logo Package', 'type' => 'text'), array('name' => 'labelc', 'label' => 'Color for for download link background.', 'description' => 'Hex code: #XXXXXX', 'type' => 'color')));
$guide->add_meta_box('logos', 'Logo Samples', array('bundle', array(array('name' => 'logo', 'label' => 'Logo', 'description' => '', 'type' => 'image'), array('name' => 'upload', 'label' => 'Logo Download File', 'description' => 'Upload logo package (.zip)', 'type' => 'file'), array('name' => 'descrip', 'label' => 'Description', 'description' => '', 'type' => 'text'))));
<?php

//Connect CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-images-alt2', 'supports' => array('title', 'editor'));
$guide = register_cuztom_post_type('Photography', $args);
$guide->add_meta_box('photography', 'header', array(array('name' => 'photo_one', 'label' => 'Photo One', 'description' => 'Upload first image.', 'type' => 'image'), array('name' => 'photo_two', 'label' => 'Photo Two', 'description' => 'Upload second image.', 'type' => 'image')));
Ejemplo n.º 8
0
 /**
  * Adds post types
  * @link   https://github.com/gizburdt/cuztom/wiki/Post-Types
  * */
 public function add_post_types()
 {
     $this->post_types['team'] = new Cuztom_Post_Type('team', array('has_archive' => true, 'supports' => array('title', 'editor', 'thumbnail')));
     register_cuztom_post_type('Team');
     $this->add_meta_boxes();
 }
Ejemplo n.º 9
0
<?php

//Connect CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-welcome-widgets-menus', 'supports' => array('title', 'editor'));
$temp = register_cuztom_post_type('Templates', $args);
$temp->add_meta_box('template', 'Template Uploads', array('bundle', array(array('name' => 'label', 'label' => 'File Label', 'description' => 'Enter template name here (ex. Brochure).', 'type' => 'text'), array('name' => 'upload', 'label' => 'Template File', 'description' => 'Upload template.', 'type' => 'file'))));
Ejemplo n.º 10
0
<?php

//Timeline CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-archive', 'supports' => array('title', 'thumbnail', 'editor', 'excerpt'), 'rewrite' => array('slug' => 'timeline'), 'show_ui' => true);
$timeline = register_cuztom_post_type('Timeline', $args);
$list = register_cuztom_taxonomy('List', 'timeline');
$list->add_term_meta(array(array('name' => 'image', 'label' => 'Featured Image', 'description' => '', 'type' => 'image'), array('name' => 'headline', 'label' => 'Featured Headline', 'description' => '', 'type' => 'text'), array('name' => 'icon', 'label' => 'Icon', 'description' => 'Go to <a href="https://fortawesome.github.io/Font-Awesome/icons/">Font Awesome</a>, chose a font and copy and paste snippet into text box. <br>For example: <b style="color: red;">fa-trophy</b>', 'type' => 'text'), array('name' => 'color', 'label' => 'Background Colour', 'description' => 'Pick a colour for the background of the timeline icon.', 'type' => 'color')));
$timeline->add_meta_box('timeline', 'timeline', array(array('name' => 'pubdate', 'label' => 'Date', 'description' => 'Enter date/year', 'type' => 'text')));
// Change the ADMIN columns for the edit CPT screen
function change_timeline_columns($cols)
{
    $cols = array('cb' => '<input type="checkbox" />', 'title' => __('Title', 'trans'), 'image' => __('Featured Image', 'trans'), 'list' => __('List', 'trans'), 'excerpt' => __('Excerpt', 'trans'), 'date' => __('Date', 'trans'));
    return $cols;
}
add_filter("manage_timeline_posts_columns", "change_timeline_columns");
// Add content to those ADMIN columns
function custom_timeline_columns($column, $post_id)
{
    switch ($column) {
        case "excerpt":
            echo wp_trim_words(get_the_excerpt(), 20, '...');
            break;
        case "image":
            if (has_post_thumbnail()) {
                echo the_post_thumbnail('thumbnail');
            } else {
                echo '<div style="background-color: #cccccc; width: 150px; height: 150px;"></div>';
            }
            break;
        case "list":
            echo get_the_term_list($post_id, 'list', '', ', ', '');
Ejemplo n.º 11
0
<?php

//Connect CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-groups', 'supports' => array('title', 'editor', 'page-attributes'), 'taxonomies' => array('category'));
$teampage = register_cuztom_post_type('team', $args);
$teampage->add_meta_box('banner', 'Featured banner', array(array('name' => 'image', 'label' => 'Banner Image', 'description' => 'Dimensions 1200px x 800px', 'type' => 'image'), array('name' => 'heading', 'label' => 'Main Heading', 'description' => '', 'type' => 'text'), array('name' => 'subheading', 'label' => 'Subheading', 'description' => '', 'type' => 'text')));
$teampage->add_meta_box('teammember', 'Team Members', array('bundle', array(array('name' => 'photo', 'label' => 'Picture', 'description' => 'Upload team member picture here.', 'type' => 'image'), array('name' => 'name', 'label' => 'Full Name', 'description' => '', 'type' => 'text'), array('name' => 'creds', 'label' => 'Credentials', 'description' => '', 'type' => 'text'), array('name' => 'jobtitle', 'label' => 'Job Title', 'description' => '', 'type' => 'text'), array('name' => 'phone', 'label' => 'Phone Number & Extension', 'description' => 'Format: (xxx) xxx-xxxx ext.xxx', 'type' => 'text'), array('name' => 'email', 'label' => 'Email', 'description' => '', 'type' => 'text'), array('name' => 'twitter', 'label' => 'Twitter Profile URL', 'description' => '', 'type' => 'text'), array('name' => 'linkedin', 'label' => 'LinkedIn Profile URL', 'description' => '', 'type' => 'text'), array('name' => 'profile', 'label' => 'Profile', 'description' => 'Enter short profile.', 'type' => 'textarea'), array('name' => 'longbio', 'label' => 'Longer Bio', 'description' => 'Enter long profile.', 'type' => 'wysiwyg'), array('name' => 'flag', 'label' => 'Department', 'description' => '', 'type' => 'select', 'options' => array('value1' => 'Exec', 'value2' => 'Member'), 'default_value' => 'value1'))));
Ejemplo n.º 12
0
<?php

//Connect CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-admin-appearance', 'supports' => array('title', 'editor'));
$colors = register_cuztom_post_type('Colours', $args);
$colors->add_meta_box('color', 'Colour Samples', array('bundle', array(array('name' => 'hex', 'label' => 'Color', 'description' => 'Choose color.', 'type' => 'color'), array('name' => 'pms', 'label' => 'PMS Value', 'description' => 'Enter the PMS value (just the number).', 'type' => 'text'), array('name' => 'cyan', 'label' => 'Cyan CMYK Value', 'description' => 'Enter the cyan (C) value.', 'type' => 'text'), array('name' => 'magenta', 'label' => 'Magenta CMYK Value', 'description' => 'Enter the magenta (M) value.', 'type' => 'text'), array('name' => 'yellow', 'label' => 'Yellow CMYK Value', 'description' => 'Enter the yellow (Y) value.', 'type' => 'text'), array('name' => 'black', 'label' => 'Black/Key CMYK Value', 'description' => 'Enter the key/black (K) value.', 'type' => 'text'))));
$colors->add_meta_box('secondary', 'Secondary Color Samples', array('bundle', array(array('name' => 'hex', 'label' => 'Color', 'description' => 'Choose color.', 'type' => 'color'), array('name' => 'pms', 'label' => 'PMS Value', 'description' => 'Enter the PMS value (just the number).', 'type' => 'text'), array('name' => 'cmyk', 'label' => 'CMYK Value', 'description' => 'Enter CMYK Value', 'type' => 'text'))));
Ejemplo n.º 13
0
<?php

//Connect CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-list-view', 'supports' => array('title', 'editor'));
$about = register_cuztom_post_type('About', $args);
$about->add_meta_box('About', 'header', array(array('name' => 'name_text', 'label' => 'Overview Intro', 'description' => 'Insert Overview intro here', 'type' => 'text'), array('name' => 'name_textarea', 'label' => 'Overview Text', 'description' => 'Insert Overview text content here.', 'type' => 'textarea')));
    return $title;
}
add_filter('enter_title_here', 'change_default_title');
/*-----------------------------------------------------------------------------------*/
/*	  custom meta box of service section 
/*-----------------------------------------------------------------------------------*/
$service = register_cuztom_post_type('service', array('supports' => array('title', 'editor'), 'show_names' => false, 'menu_icon' => 'dashicons-id'));
$service->add_meta_box('service_setting_id', 'Service Section Settings', array(array('name' => 'icon', 'label' => 'Icon', 'description' => 'Write icon class - "li_star, li_lab, li_world" <a target="_blank" href="https://github.com/fontello/linecons.font">Click Here</a>', 'type' => 'text'), array('name' => 'learn_more', 'label' => 'Edit Learn More', 'description' => '', 'type' => 'text', 'default_value' => 'Learn More'), array('name' => 'animation', 'label' => 'Animation', 'description' => 'Write the class here like "from-bottom delay-200"', 'type' => 'text', 'default_value' => 'from-bottom delay-200')));
/*-----------------------------------------------------------------------------------*/
/*	  portfolio custom post type with  metabox
/*-----------------------------------------------------------------------------------*/
$gallery = register_cuztom_post_type('gallery', array('menu_icon' => 'dashicons-analytics', 'rewrite' => array('slug' => 'galleries', 'with_front' => false), 'supports' => array('title', 'thumbnail')));
$gallery->add_meta_box('gallery_setting_id', 'gallery Section Settings', array(array('name' => 'caption', 'label' => 'Caption', 'description' => 'Write Image Caption', 'type' => 'textarea')));
$gallery = register_cuztom_taxonomy('filter_menu', array('gallery'), array('hierarchical' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => true));
/*-----------------------------------------------------------------------------------*/
/*	  causes custom post type with  metabox
/*-----------------------------------------------------------------------------------*/
$causes = register_cuztom_post_type('causes', array('menu_icon' => 'dashicons-migrate', 'rewrite' => array('slug' => 'causes', 'with_front' => false), 'supports' => array('title', 'thumbnail', 'editor')));
$causes->add_meta_box('causes_setting_id', 'Causes Section Settings', array(array('name' => 'donation_currency_symbol', 'label' => 'Currency Symbol', 'description' => 'Add your Currency Symbol', 'default_value' => '$', 'type' => 'text'), array('name' => 'donation_goal', 'label' => 'Donation goal', 'description' => 'How much is the donation goal for this cause.', 'type' => 'text'), array('name' => 'donation_manual', 'label' => 'Donate manually', 'description' => 'Write manual ammount, that will add with current ammount', 'type' => 'text'), array('name' => 'donation_paypal', 'label' => 'PayPal', 'description' => 'Write Your PayPal Id.', 'type' => 'text'), array('name' => 'bank_transfer_manual', 'label' => 'Direct Bank Transfer', 'description' => 'Trasfer money to the following bank account (Write the bank account info)', 'type' => 'textarea'), array('name' => 'chaque_payment', 'label' => 'Check Payment', 'description' => 'Send chaque to the following address. (Writer the address)', 'type' => 'textarea'), array('name' => 'menual_payment_link', 'label' => 'Custom URL/WooCommerce Product link', 'description' => "<b style=\"color: red;\">If PayPal Donate field blank, This custom link will work. Paste woocommerce product link</b>", 'type' => 'text')));
/*-----------------------------------------------------------------------------------*/
/*	custom post type of event with meta box 
/*-----------------------------------------------------------------------------------*/
$event = register_cuztom_post_type('event', array('menu_icon' => 'dashicons-art', 'rewrite' => array('slug' => 'events', 'with_front' => false), 'supports' => array('title', 'thumbnail', 'editor')));
$event->add_meta_box('events_setting_id', 'Events Section Settings', array(array('name' => 'event_time', 'label' => 'Event Start', 'description' => 'When event will start', 'type' => 'time'), array('name' => 'event_time_end', 'label' => 'Event End', 'description' => 'When event will end', 'type' => 'time'), array('name' => 'event_date', 'label' => 'Event Date', 'description' => 'Event starting date', 'type' => 'date'), array('name' => 'event_timezone', 'label' => 'Event Timezone', 'description' => 'Write Time zone', 'type' => 'text'), array('name' => 'event_place', 'label' => 'Event Place', 'description' => 'Where event will held', 'type' => 'textarea'), array('name' => 'event_place_map', 'label' => 'Map', 'description' => 'write longitude & latitude with coma. <a target="_blank" href="http://www.gps-coordinates.net/">Click here</a> for help.', 'type' => 'text')));
/*-----------------------------------------------------------------------------------*/
/*	post formate meta box 
/*-----------------------------------------------------------------------------------*/
$posts = new Cuztom_Post_Type('post');
$posts->add_meta_box('post-meta-quote', 'Page Head', array(array('name' => 'speaker', 'label' => 'Who said that', 'description' => 'Write the name of speaker name', 'type' => 'text')));
$posts->add_meta_box('post-meta-audio', 'Audio settings', array(array('name' => 'audio', 'label' => 'Upload Audio file', 'description' => 'It will play above the title', 'type' => 'file')));
$posts->add_meta_box('post-meta-video', 'Video settings', array(array('name' => 'video', 'label' => 'Link', 'description' => 'It will play above the title', 'type' => 'text')));
Ejemplo n.º 15
0
<?php

//Annual Report CPT
$args = array('has_archive' => true, 'hierarchical' => true, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-chart-area', 'supports' => array('title', 'page-attributes', 'thumbnail'));
$annual = register_cuztom_post_type('Annual Report', $args);
$annual->add_meta_box('title', 'Report Section', array(array('name' => 'headline', 'label' => 'Title', 'description' => 'Title for report section', 'type' => 'text'), array('name' => 'summary', 'label' => 'Summary', 'description' => 'Description of section', 'type' => 'textarea'), array('name' => 'background', 'label' => 'Panel colour', 'description' => 'Pick panel colour', 'type' => 'color')));
$annual->add_meta_box('annual', 'Report Story', array('bundle', array(array('name' => 'primary', 'label' => 'Primary', 'description' => 'Main story point. <br>Just one or two sentences.', 'type' => 'textarea'), array('name' => 'secondary', 'label' => 'Secondary', 'description' => '(Optional) Supporting story point. <br>Just one or two sentences', 'type' => 'textarea'), array('name' => 'number', 'label' => 'Number', 'description' => 'Number you would like to highlight', 'type' => 'text'), array('name' => 'link', 'label' => 'URL', 'description' => '(Optional) Add a supporting link. <br> Example: http://www.foodshare...', 'type' => 'text'), array('name' => 'linkname', 'label' => 'Link name', 'description' => 'Link Text', 'type' => 'text'), array('name' => 'image', 'label' => 'Image', 'description' => 'Dimensions 750px x 750px', 'type' => 'image'))));
Ejemplo n.º 16
0
         )
	));
*/
/**
 *CPT for Location
 */
$utplocation = register_cuztom_post_type('location', array('has_archive' => true, 'supports' => array('title')));
$utplocation->add_meta_box('Location Details', array(array('name' => 'utplocation_name', 'label' => 'Physical Address', 'description' => '(Note: This section will be thought out in more detail)', 'type' => 'textarea')));
/**
 *CPT for Specialities
 */
$utpspecialties = register_cuztom_post_type('specialties', array('has_archive' => true, 'supports' => array('title')));
/**
 *CPT FOR CLINICS 
 */
$utpclinic = register_cuztom_post_type('clinic', array('has_archive' => true, 'supports' => array('title')));
$utpclinic->add_meta_box('Clinic Details', array(array('name' => 'utpclinic_address', 'label' => 'Clinic Address', 'type' => 'textarea'), array('name' => 'utpclinic_phone', 'label' => 'Clinic Phone', 'description' => '(The first number is the primary)', 'type' => 'text'), array('name' => 'utpclinic_afterhoursphone', 'label' => 'Afterhours Phone', 'type' => 'text'), array('name' => 'utpclinic_fax', 'label' => 'Clinic Fax', 'type' => 'text'), array('name' => 'utpclinic_weekdayhours', 'label' => 'Clinic Hours M-F', 'description' => '(Format: 8-5, 9-5)', 'type' => 'text'), array('name' => 'utpclinic_weekendhours', 'label' => 'Clinic Hours Weekends', 'description' => '(Format: Sat 8-5, +Add Sun 9-5)', 'type' => 'text', 'repeatable' => true)));
/**
*CPT-onomies
http://rachelcarden.com/cpt-onomies/
*/
/*add_action( 'wp_loaded', 'my_website_register_cpt_onomy' );

function my_website_register_cpt_onomy() {
   global $cpt_onomies_manager;
   $cpt_onomies_manager->register_cpt_onomy( 'Clinic', 'Location', array( 'restrict_user_capabilities' => array( 'administrator' ) ) );
}*/
add_filter('custom_post_type_onomies_meta_box_format', 'my_website_custom_post_type_onomies_meta_box_format', 1, 3);
function my_website_custom_post_type_onomies_meta_box_format($format, $taxonomy, $post_type)
{
    //return options are autocomplete, checklist and dropdown
Ejemplo n.º 17
0
<?php

//Connect CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-smiley', 'supports' => array('title'), 'labels' => array('name' => 'Staff'));
$staff = register_cuztom_post_type('Staff', $args);
$role = register_cuztom_taxonomy('Role', 'staff');
$staff->add_meta_box('staff', 'Employee', array(array('name' => 'image', 'label' => 'Profile image', 'description' => 'Dimensions 300px x 300px', 'type' => 'image'), array('name' => 'title', 'label' => 'Job Title', 'decription' => '', 'type' => 'text'), array('name' => 'email', 'label' => 'Email', 'description' => '', 'type' => 'text'), array('name' => 'phone', 'label' => 'Direct', 'description' => '', 'type' => 'text'), array('name' => 'extension', 'label' => 'Extension', 'description' => '', 'type' => 'text'), array('name' => 'bio', 'label' => 'Bio', 'description' => '', 'type' => 'wysiwyg')));
// Change the ADMIN columns for the edit CPT screen
function change_staff_columns($cols)
{
    $cols = array('cb' => '<input type="checkbox" />', 'title' => __('Name', 'trans'), 'avatar' => __('Profile Image', 'trans'), 'role' => __('Role', 'trans'), 'job' => __('Job Title', 'trans'), 'email' => __('Email', 'trans'), 'date' => __('Date', 'trans'));
    return $cols;
}
add_filter("manage_staff_posts_columns", "change_staff_columns");
// Add content to those ADMIN columns
function custom_staff_columns($column, $post_id)
{
    switch ($column) {
        case "avatar":
            $staff_image_id = get_post_meta($post_id, '_staff_image', true);
            $staff_image_url = wp_get_attachment_image_src($staff_image_id, 'thumbnail', true);
            if (!$staff_image_id) {
                echo '<div style="background-color: #cccccc; width: 150px; height: 150px; border-radius: 50%;"></div>';
            } else {
                echo '<img style="border-radius: 50%;" src=' . $staff_image_url[0] . '>';
            }
            break;
        case "job":
            echo get_post_meta($post_id, '_staff_title', true);
            break;
        case "email":
Ejemplo n.º 18
0
    $results_pt = register_cuztom_post_type('Result');
    // Add taxonomies
    $results_pt->add_taxonomy('Region');
    insert_region_taxonomy_terms();
    $results_pt->add_taxonomy('Implementing Partner');
    insert_implementing_partner_taxonomy_terms();
    $results_pt->add_taxonomy('Focus / Areas of Impact');
    insert_focus_area_impact_taxonomy_terms();
    $results_pt->add_taxonomy('Sector');
    insert_sector_taxonomy_terms();
    $results_pt->add_taxonomy('Publication Type');
    insert_publication_type_taxonomy_terms();
    $results_pt->add_taxonomy('Proyecto');
    $implementin_partners_pt = register_cuztom_post_type('Implementing Partner');
    $implementin_partners_pt = register_cuztom_post_type('Proyecto');
    $implementin_partners_pt = register_cuztom_post_type('Slider');
    register_taxonomy_for_object_type('implementing_partner', 'post');
});
/*
 * Insert region taxonomy terms
 */
function insert_region_taxonomy_terms()
{
    $regions = array('Global Initiatives', 'Africa', 'Asia', 'Eastern Europe & Central Asia', 'Caribbean', 'Latin America');
    foreach ($regions as $region) {
        $term = term_exists($region, 'region');
        if (FALSE !== $term && NULL !== $term) {
            continue;
        }
        wp_insert_term($region, 'region');
    }
<?php

//Connect CPT
$args = array('has_archive' => true, 'hierarchical' => true, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-admin-comments', 'supports' => array('title'), 'show_in_rest' => true);
$test = register_cuztom_post_type('Testimonial', $args);
$test->add_meta_box('single', 'Testimonials', array(array('name' => 'quotation', 'label' => 'Testimonial', 'description' => '', 'type' => 'textarea'), array('name' => 'source', 'label' => 'Source', 'description' => '', 'type' => 'text'), array('name' => 'title', 'label' => 'Source Title', 'description' => '', 'type' => 'text')));
Ejemplo n.º 20
0
<?php

//Create services custom post type
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-portfolio', 'supports' => array('title', 'editor', 'thumbnail'));
$course = register_cuztom_post_type('service', $args);
Ejemplo n.º 21
0
<?php

//Connect CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-editor-textcolor', 'supports' => array('title', 'editor'));
$type = register_cuztom_post_type('Typography', $args);
$type->add_meta_box('typescript', 'scripts', array(array('name' => 'fontscript', 'label' => 'Font Script', 'description' => 'Enter the script to load your fonts.', 'type' => 'textarea')));
$type->add_meta_box('type', 'Custom Type', array('bundle', array(array('name' => 'fontname', 'label' => 'Font Name', 'description' => 'Enter the font family here.', 'type' => 'text'), array('name' => 'extext', 'label' => 'Example Text', 'description' => 'Example: h1. Main Title', 'type' => 'text'), array('name' => 'fsize', 'label' => 'Font Size', 'description' => 'Format - XXpx (ex. 52px).', 'type' => 'text'), array('name' => 'lineheight', 'label' => 'Line Height', 'description' => 'Format - XXpx (ex. 52px).', 'type' => 'text'), array('name' => 'fweight', 'label' => 'Font Weight', 'description' => 'Possible values are dependent on your font script (ex. 100, 200, 300, 600).', 'type' => 'text'), array('name' => 'fstyle', 'label' => 'Font Style', 'description' => 'Possible values: normal, italic.', 'type' => 'text'), array('name' => 'case', 'label' => 'Uppercase?', 'description' => 'Possible values: lowercase, uppercase.', 'type' => 'text'), array('name' => 'spacing', 'label' => 'Letter Spacing', 'description' => '', 'type' => 'text'))));
$type->add_meta_box('introtext', 'Intro Text', array(array('name' => 'introfont', 'label' => 'Intro Font', 'description' => 'Enter the font family here.', 'type' => 'text'), array('name' => 'introexample', 'label' => 'Intro Text', 'description' => 'Enter the intro font example here.', 'type' => 'textarea'), array('name' => 'fsize', 'label' => 'Font Size', 'description' => 'Format - XXpx (ex. 52px).', 'type' => 'text'), array('name' => 'fweight', 'label' => 'Font Weight', 'description' => 'Possible values are dependent on your font script (ex. 100, 200, 300, 600).', 'type' => 'text'), array('name' => 'fstyle', 'label' => 'Font Style', 'description' => 'Possible values: normal, italic.', 'type' => 'text'), array('name' => 'case', 'label' => 'Uppercase?', 'description' => 'Possible values: lowercase, uppercase.', 'type' => 'text')));
$type->add_meta_box('bodyfont', 'Body Copy', array(array('name' => 'bodyfont', 'label' => 'Body Font', 'description' => 'Enter the font family here.', 'type' => 'text'), array('name' => 'bodyexample', 'label' => 'Body Text', 'description' => 'Enter the body font example here.', 'type' => 'textarea'), array('name' => 'fsize', 'label' => 'Font Size', 'description' => 'Format - XXpx (ex. 52px).', 'type' => 'text'), array('name' => 'fweight', 'label' => 'Font Weight', 'description' => 'Possible values are dependent on your font script (ex. 100, 200, 300, 600).', 'type' => 'text'), array('name' => 'fstyle', 'label' => 'Font Style', 'description' => 'Possible values: normal, italic.', 'type' => 'text'), array('name' => 'case', 'label' => 'Uppercase?', 'description' => 'Possible values: lowercase, uppercase.', 'type' => 'text')));
$type->add_meta_box('quotetext', 'Quotation Text', array(array('name' => 'quotefont', 'label' => 'Quotation Font', 'description' => 'Enter the font family here.', 'type' => 'text'), array('name' => 'quoteexample', 'label' => 'Quotation Text', 'description' => 'Enter the quotation font example here.', 'type' => 'textarea'), array('name' => 'fsize', 'label' => 'Font Size', 'description' => 'Format - XXpx (ex. 52px).', 'type' => 'text'), array('name' => 'fweight', 'label' => 'Font Weight', 'description' => 'Possible values are dependent on your font script (ex. 100, 200, 300, 600).', 'type' => 'text'), array('name' => 'fstyle', 'label' => 'Font Style', 'description' => 'Possible values: normal, italic.', 'type' => 'text'), array('name' => 'case', 'label' => 'Uppercase?', 'description' => 'Possible values: lowercase, uppercase.', 'type' => 'text'), array('name' => 'srcfont', 'label' => 'Source Font', 'description' => 'Enter the font family here.', 'type' => 'text'), array('name' => 'srcex', 'label' => 'Source Text', 'description' => 'Enter the quotation source here.', 'type' => 'textarea'), array('name' => 'fsize_2', 'label' => 'Font Size', 'description' => 'Format - XXpx (ex. 52px).', 'type' => 'text'), array('name' => 'fweight_2', 'label' => 'Font Weight', 'description' => 'Possible values are dependent on your font script (ex. 100, 200, 300, 600).', 'type' => 'text'), array('name' => 'fstyle_2', 'label' => 'Font Style', 'description' => 'Possible values: normal, italic.', 'type' => 'text'), array('name' => 'case_2', 'label' => 'Uppercase?', 'description' => 'Possible values: lowercase, uppercase.', 'type' => 'text')));
Ejemplo n.º 22
0
            break;
        case 'ו':
            $day_name = 'שישי';
            break;
        case 'ש':
            $day_name = 'שבת';
            break;
    }
    $day_name = 'יום ' . $day_name;
    return $day_name;
}
$message = register_cuztom_post_type('Message');
$event = register_cuztom_post_type('Event');
$gym_class = register_cuztom_post_type('Gym Class');
$employee = register_cuztom_post_type('Employee');
$form = register_cuztom_post_type('Form');
$gym_class->add_taxonomy('Class Day');
$page_group = register_cuztom_taxonomy('Page Group', 'page');
function live_stock_value()
{
    $quote = file_get_contents('http://www.google.com/finance/info?q=NYSE:HPQ');
    //Remove CR's from ouput - make it one line
    $json = str_replace("\n", "", $quote);
    //Remove //, [ and ] to build qualified string
    $data = substr($json, 4, strlen($json) - 5);
    //decode JSON data
    $json_output = json_decode($data, true);
    ?>
    <div class="b-wrap js-scale-block">
        <div class="b-exchange">
            <span class="company">Hewlett-Packard</span>
Ejemplo n.º 23
0
<?php

//Connect CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-list-view', 'supports' => array('title', 'editor'));
$guide = register_cuztom_post_type('Overview', $args);
$guide->add_meta_box('overview', 'header', array(array('name' => 'name_text', 'label' => 'Overview Intro', 'description' => 'Insert Overview intro here', 'type' => 'text'), array('name' => 'name_textarea', 'label' => 'Overview Text', 'description' => 'Insert Overview text content here.', 'type' => 'textarea')));
Ejemplo n.º 24
0
<?php

//Connect CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-megaphone', 'supports' => array('title', 'editor'));
$guide = register_cuztom_post_type('Tone', $args);
$guide->add_meta_box('tone', 'header', array(array('name' => 'name_text', 'label' => 'Overview Intro', 'description' => 'Insert Overview intro here', 'type' => 'text'), array('name' => 'name_textarea', 'label' => 'Overview Text', 'description' => 'Insert Overview text content here.', 'type' => 'textarea')));
Ejemplo n.º 25
0
<?php

// Courses and Registration CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-welcome-learn-more', 'supports' => array('title'));
$course = register_cuztom_post_type('Course', $args);
$course_type = register_cuztom_taxonomy('Courses type', 'course');
// Add option to enable/disable register button to course
/*$course_type->add_term_meta (
	array(
		array(
			'name'        => 'register_on_off',
			'label'       => 'Register ON/OFF',
			'description' => 'Select to enable registration to this course type.',
			'type'        => 'checkbox'
		)
	)
);*/
$course->add_meta_box('Course Details', 'course_details', array(array('name' => 'register_open', 'label' => 'Registration Open', 'description' => 'Please select this to make registration open for this course.(Default is closed.)', 'type' => 'checkbox', 'default_value' => 'off'), array('name' => 'register_form_id', 'label' => 'Registration Form ID', 'description' => 'Please enter gravity form id.', 'type' => 'text'), array('name' => 'description', 'label' => 'Course Description', 'description' => 'Description of course', 'type' => 'wysiwyg'), array('name' => 'price', 'label' => 'Price', 'description' => 'Example: 899.00', 'type' => 'text'), array('name' => 'course_in_week', 'label' => 'Course no. of days in week', 'description' => 'Enter course no. of days in week', 'type' => 'text'), array('name' => 'duration', 'label' => 'Course Duration', 'description' => 'Enter period when course ends', 'type' => 'text'), array('name' => 'schedule', 'label' => 'Course schedule', 'description' => 'Enter schedule/season', 'type' => 'text'), array('name' => 'end_of_course', 'label' => 'Course End Date', 'description' => 'Enter course end date', 'type' => 'date')));
//Organize admin columns
function course_columns($cols)
{
    $cols = array('cb' => '<input type="checkbox" />', 'title' => __('Title', 'trans'), '_course_details_price' => __('Price', 'trans'), '_course_details_instructor' => __('Instructor', 'trans'), '_course_details_spots' => __('Availability', 'trans'), 'date' => __('Date', 'trans'));
    return $cols;
}
add_filter("manage_course_posts_columns", "course_columns");
Ejemplo n.º 26
0
<?php

//Program CPT
$args = array('has_archive' => true, 'hierarchical' => true, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-video-alt2', 'supports' => array('title'), 'show_in_rest' => true);
$video = register_cuztom_post_type('Video', $args);
$video->add_meta_box('video', 'Video', array(array('name' => 'description', 'label' => 'Description', 'description' => 'Video description', 'type' => 'textarea'), array('name' => 'youtube', 'label' => 'Youtube', 'description' => 'Enter the embed id ONLY in the URL. Example: https://www.youtube.com/embed/<b style="color: red;">dBnniua6-oM</b>. <b>Enter ONLY what\'s in red</b>', 'type' => 'text'), array('name' => 'vimeo', 'label' => 'Vimeo', 'description' => 'Enter the number id ONLY in the URL. Example: http://www.vimeo.com/<b style="color: red;">1234567</b>. <b>Enter ONLY what\'s in red</b>', 'type' => 'text')));
// Change the ADMIN columns for the edit CPT screen
function change_video_columns($cols)
{
    $cols = array('cb' => '<input type="checkbox" />', 'title' => __('Title', 'trans'), 'video' => __('Video', 'trans'), 'desc' => __('Description', 'trans'), 'date' => __('Date', 'trans'));
    return $cols;
}
add_filter("manage_video_posts_columns", "change_video_columns");
// Add content to those ADMIN columns
function custom_video_columns($column, $post_id)
{
    $youtube = get_post_meta($post_id, '_video_youtube', true);
    $vimeo = get_post_meta($post_id, '_video_vimeo', true);
    switch ($column) {
        case "desc":
            echo wp_trim_words(get_post_meta($post_id, '_video_description', true), 20, '...');
            break;
        case "video":
            if ($vimeo) {
                ?>
            <iframe src="https://player.vimeo.com/video/<?php 
                echo $vimeo;
                ?>
" width="270" height="150" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
            <?php 
                echo '<br>Vimeo';
Ejemplo n.º 27
0
<?php

//Connect CPT
$args = array('has_archive' => true, 'menu_icon' => 'dashicons-admin-multisite', 'supports' => array('title', 'editor', 'page-attributes'), 'taxonomies' => array('category'), 'show_in_rest' => true);
$projects = register_cuztom_post_type('Project', $args);
$projects->add_meta_box('banner', 'Hero Banner', array(array('name' => 'image', 'label' => 'Banner Image', 'description' => 'Dimensions 1200px x 800px', 'type' => 'image'), array('name' => 'herovid', 'label' => 'Video Header', 'description' => 'Select a video to appear in the header.', 'type' => 'post_select', 'args' => array('post_type' => 'video', 'show_option_none' => "Select a video")), array('name' => 'heading', 'label' => 'Banner Text', 'description' => 'Enter text', 'type' => 'text'), array('name' => 'subheading', 'label' => 'Banner Subheading', 'description' => 'Enter text', 'type' => 'text')));
$projects->add_meta_box('badge', 'Hero Badge', array(array('name' => 'text', 'label' => 'Badge Text', 'description' => '', 'type' => 'wysiwyg'), array('name' => 'link', 'label' => 'Badge Link', 'description' => '', 'type' => 'text')));
$projects->add_meta_box('blurb', 'Hero Blurb', array(array('name' => 'heroblurb', 'label' => 'Hero Blurb', 'description' => '', 'type' => 'textarea')));
$projects->add_meta_box('stats', 'Project Stats', array(array('name' => 'client', 'label' => 'Client', 'description' => '', 'type' => 'text'), array('name' => 'sf', 'label' => 'Square Footage', 'description' => '', 'type' => 'text'), array('name' => 'budget', 'label' => 'Budget', 'description' => '', 'type' => 'text'), array('name' => 'duration', 'label' => 'Duration', 'description' => '', 'type' => 'text'), array('name' => 'location', 'label' => 'Location', 'description' => '', 'type' => 'text')));
$projects->add_meta_box('video', 'Video <i>(Optional)</i>', array(array('name' => 'select', 'label' => 'Select a related video', 'description' => '', 'type' => 'post_select', 'args' => array('post_type' => 'video', 'show_option_none' => "Select a video"))));
$projects->add_meta_box('test', 'Testimonial <i>(Optional)</i>', array(array('name' => 'select', 'label' => 'Select a testimonial', 'description' => '', 'type' => 'post_select', 'args' => array('post_type' => 'testimonial', 'show_option_none' => "Select a testimonial"))));
$projects->add_meta_box('slide', 'Gallery <i>(Optional)</i>', array(array('name' => 'select', 'label' => 'Select a related gallery', 'description' => '', 'type' => 'post_select', 'args' => array('post_type' => 'gallery', 'show_option_none' => "Select a Gallery"))));
Ejemplo n.º 28
0
<?php

//Resource CPT
$args = array('has_archive' => true, 'hierarchical' => true, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-index-card', 'supports' => array('title', 'editor'));
$resource = register_cuztom_post_type('Resource', $args);
$resource->add_meta_box('resource', 'Resource', array(array('name' => 'document', 'label' => 'File', 'description' => 'Select a file to associate with this resource', 'type' => 'file'), array('name' => 'select', 'label' => 'Program', 'description' => 'Select the program this file should be assigned to', 'type' => 'post_select', 'args' => array('post_type' => 'program', 'show_option_none' => "Select Program"))));
Ejemplo n.º 29
0
<?php

//Program CPT
$args = array('has_archive' => true, 'hierarchical' => true, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-groups', 'supports' => array('title', 'editor', 'page-attributes', 'author'), 'taxonomies' => array('category'));
$programpage = register_cuztom_post_type('program', $args);
$programpage->add_meta_box('owner', 'Program Lead', array(array('name' => 'select', 'label' => 'Select the program lead', 'description' => '', 'type' => 'post_select', 'args' => array('post_type' => 'staff', 'show_option_none' => "Select Program Lead"))));
$programpage->add_meta_box('banner', 'Featured banner', array(array('name' => 'image', 'label' => 'Banner Image', 'description' => 'Dimensions 1200px x 800px', 'type' => 'image'), array('name' => 'headline', 'label' => 'Banner headline', 'description' => 'Enter text', 'type' => 'textarea'), array('name' => 'logo', 'label' => 'Program Logo', 'description' => '', 'type' => 'image')));
$programpage->add_meta_box('action', 'Take action', array(array('name' => 'button', 'label' => 'Button label', 'description' => 'Enter button label and make your users want to click', 'type' => 'text'), array('name' => 'text', 'label' => 'Content', 'description' => 'Description of action', 'type' => 'wysiwyg')));
$programpage->add_meta_box('testimonial', 'Testimonial', array(array('name' => 'blockquote', 'label' => 'Testimonial', 'description' => 'Enter text', 'type' => 'textarea')));
$programpage->add_meta_box('metrics', 'Program metrics', array('tabs', array('Metric 1' => array(array('name' => 'stat_num_1', 'label' => 'Metric number', 'description' => 'Enter metric as a number. i.e "17"', 'type' => 'text'), array('name' => 'stat_text_1', 'label' => 'Metric headline', 'description' => 'Enter text', 'type' => 'text')), 'Metric 2' => array(array('name' => 'stat_num_2', 'label' => 'Metric number', 'description' => 'Enter metric as a number. i.e "17"', 'type' => 'text'), array('name' => 'stat_text_2', 'label' => 'Metric headline', 'description' => 'Enter text', 'type' => 'text')), 'Metric 3' => array(array('name' => 'stat_num_3', 'label' => 'Metric number', 'description' => 'Enter metric as a number. i.e "17"', 'type' => 'text'), array('name' => 'stat_text_3', 'label' => 'Metric headline', 'description' => 'Enter text', 'type' => 'text')))));
$programpage->add_meta_box('related', 'Reading <i>(Optional)</i>', array(array('name' => 'text', 'label' => 'Related reading', 'description' => '', 'type' => 'wysiwyg')));
$programpage->add_meta_box('video', 'Video <i>(Optional)</i>', array(array('name' => 'select', 'label' => 'Select a related video', 'description' => '', 'type' => 'post_select', 'args' => array('post_type' => 'video', 'show_option_none' => "Select a Video"))));
$programpage->add_meta_box('slide', 'Gallery <i>(Optional)</i>', array(array('name' => 'select', 'label' => 'Select a related gallery', 'description' => '', 'type' => 'post_select', 'args' => array('post_type' => 'gallery', 'show_option_none' => "Select a Gallery"))));
$programpage->add_meta_box('map', 'Map <i>(Optional)</i>', array(array('name' => 'select', 'label' => 'Select a related map', 'description' => '', 'type' => 'post_select', 'args' => array('post_type' => 'map', 'show_option_none' => "Select a Map"))));
// Change the ADMIN columns for the edit CPT screen
function change_program_columns($cols)
{
    $cols = array('cb' => '<input type="checkbox" />', 'title' => __('Name', 'trans'), 'image' => __('Banner Image', 'trans'), 'category' => __('Category', 'trans'), 'excerpt' => __('Excerpt', 'trans'), 'date' => __('Date', 'trans'));
    return $cols;
}
add_filter("manage_program_posts_columns", "change_program_columns");
// Add content to those ADMIN columns
function custom_program_columns($column, $post_id)
{
    switch ($column) {
        case "image":
            $banner_image_id = get_post_meta($post_id, '_banner_image', true);
            $banner_image_url = wp_get_attachment_image_src($banner_image_id, 'thumbnail', true);
            if (!$banner_image_id) {
                echo '<div style="background-color: #cccccc; width: 150px; height: 150px;"></div>';
            } else {
Ejemplo n.º 30
0
 public function contentHeaderCustomField($post_type)
 {
     $title = null;
     $titleAs = null;
     $subtitle = null;
     $subtitleAs = null;
     if (HEADER_TITLES) {
         $title = array('name' => 'titel', 'label' => 'Titel', 'description' => 'Selecteer afbeelding', 'type' => 'text');
         $titleAs = array('name' => 'titelals', 'label' => 'titel als :', 'description' => 'Hoe moet de titel worden weergegeven', 'type' => 'select', 'options' => array('div' => 'div', 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6'), 'default_value' => 'div');
         $subtitle = array('name' => 'subtitel', 'label' => 'Subtitel', 'description' => 'Welke subtitel wil je weergeven', 'type' => 'text');
         $subtitleAs = array('name' => 'subtitelals', 'label' => 'Subtitel als :', 'description' => 'Hoe moet de subtitel worden weergegeven', 'type' => 'select', 'options' => array('div' => 'div', 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6'), 'default_value' => 'div');
     }
     // create metaBox with select option
     $page = register_cuztom_post_type($post_type);
     $page->add_meta_box('header', 'Page Header Options', array(array('name' => 'type', 'label' => 'type header', 'description' => 'selecteer het type header', 'type' => 'select', 'options' => array('noHeader' => 'Geen header', 'image' => 'Afbeelding', 'shortcode' => 'Shortcode', 'video' => 'Video')), array('name' => 'shortcode', 'label' => 'shortcode', 'description' => 'geef de shortcode in ', 'type' => 'text'), array('name' => 'image', 'label' => 'image', 'description' => 'Selecteer afbeelding', 'type' => 'image'), array('name' => 'video', 'label' => 'Video', 'description' => 'Selecteer afbeelding', 'type' => 'file'), $title, $titleAs, $subtitle, $subtitleAs));
 }