$schedule->columns(array('cb' => '<input type="checkbox" />', 'title' => __('Title'), 'schedule_year' => __('Festival Year'), 'date' => __('Date'))); $schedule->sortable(array('schedule_year' => array('schedule_year', true))); // Schedule icon $schedule->menu_icon("dashicons-schedule"); $schedule->menu_position(7); /** * ---------------- * SPONSORS * ---------------- */ $sponsors = new CPT('sponsor'); // Sponsors taxonomy $sponsors->register_taxonomy('level'); // Sponsors columns $sponsors->columns(array('cb' => '<input type="checkbox" />', 'title' => __('Title'), 'level' => __('Sponsor Level'), 'date' => __('Date'))); $sponsors->sortable(array('level' => array('level', true))); // Sponsors menu $sponsors->menu_icon("dashicons-heart"); $sponsors->menu_position(8); /** * Shortcodes * --------------------------------------------------------------------------- */ // SPONSORS - [sponsors level="premuium" columns="3"] add_shortcode('sponsors', 'postsponsors'); function postsponsors($atts) { extract(shortcode_atts(array('level' => '', 'columns' => '', 'mobile' => ''), $atts)); $output = ''; $term = $atts['level']; $cols = $atts['columns'];
Author URI: http://www.github.com/rushdi1987/ */ defined('ABSPATH') or die('No script kiddies please!'); // include the custom post type class include_once 'class-post-type.php'; // create a member custom post type $members = new CPT('member', array('supports' => array('title', 'excerpt', 'thumbnail'))); // create a department taxonomy $members->register_taxonomy('department'); // define the columns to appear on the admin edit screen $members->columns(array('cb' => '<input type="checkbox" />', 'title' => __('Title'), 'department' => __('Departments'), 'price' => __('Price'), 'rating' => __('Rating'), 'date' => __('Date'), 'age' => __('Age'), 'location' => __('Location'))); // populate the price column $members->populate_column('price', function ($column, $post) { echo "£" . get_field('price'); // ACF get_field() function }); // populate the ratings column $members->populate_column('rating', function ($column, $post) { echo get_field('rating') . '/5'; // ACF get_field() function }); // populate the ratings column $members->populate_column('location', function ($column, $post) { echo get_post_field('location', $post->ID) . ', Bangladesh'; // ACF get_field() function }); // make rating and price columns sortable $members->sortable(array('price' => array('price', true), 'rating' => array('rating', true), 'location' => array('location', true))); // use "pages" icon for post type $members->menu_icon("slide.png"); $members->add_tm_custom_post_metaboxes('Location');
<?php // Register shows Post Type $shows = new CPT('show', array('supports' => array('title', 'thumbnail'))); $music = new CPT('album', array('supports' => array('title', 'thumbnail'))); $shows->columns(array('cb' => '<input type="checkbox" />', 'title' => __('Title'), 'show_date' => __('Date'), 'venue' => __('Venue'), 'city' => __('City'), 'state' => __('State'))); $shows->populate_column('show_date', function ($column, $post) { echo get_field('show_date'); }); $shows->populate_column('venue', function ($column, $post) { echo get_field('show_venue'); }); $shows->populate_column('city', function ($column, $post) { echo get_field('show_city'); }); $shows->populate_column('state', function ($column, $post) { echo get_field('show_state'); }); $shows->sortable(array('date' => array('meta_key', true)));