Esempio n. 1
0
function setupCustomPostTypes()
{
    $global_cpt_args = array('has_archive' => true, 'menu_position' => 3, 'public' => true, 'show_in_nav_menus' => true, 'supports' => array('title', 'editor', 'excerpt', 'author', 'thumbnail', 'revisions'));
    $ecoregion = new CPT(array('post_type_name' => 'ecoregion', 'singular' => 'Ecoregion', 'plural' => 'Ecoregions', 'slug' => 'ecoregion'), array_merge($global_cpt_args, array('menu_position' => 4)));
    $ecoregion->menu_icon('dashicons-admin-site');
    $kci = new CPT(array('post_type_name' => 'kci', 'singular' => 'KCI', 'plural' => 'KCIs', 'slug' => 'key-conservation-issue'), array_merge($global_cpt_args, array('menu_position' => 6)));
    $kci->menu_icon('dashicons-admin-network');
    //$kci->add_admin_columns(array('post_id'=>'post_id'));
    $coa = new CPT(array('post_type_name' => 'coa', 'singular' => 'COA', 'plural' => 'COAs', 'slug' => 'conservation-opportunity-area'), array_merge($global_cpt_args, array('menu_position' => 9)));
    $coa->menu_icon('dashicons-editor-ul');
    $strategy_habitat = new CPT(array('post_type_name' => 'strategy_habitat', 'singular' => 'Strategy Habitat', 'plural' => 'Strategy Habitats', 'slug' => 'strategy-habitat'), array_merge($global_cpt_args, array('menu_position' => 7)));
    $strategy_habitat->menu_icon('dashicons-format-image');
    $ss_options = array_merge($global_cpt_args, array('menu_position' => 8, 'hierarchical' => true, 'taxonomies' => array('species'), 'supports' => array('title', 'editor', 'author', 'thumbnail', 'page-attributes')));
    $strategy_species = new CPT(array('post_type_name' => 'strategy_species', 'singular' => 'Strategy Species', 'plural' => 'Strategy Species', 'slug' => 'strategy-species'), $ss_options);
    $strategy_species->menu_icon('dashicons-id');
    $success_story = new CPT(array('post_type_name' => 'success_story', 'singular' => 'Strategy Spotlight', 'plural' => 'Strategy Spotlights', 'slug' => 'success-story'), array_merge($global_cpt_args, array('menu_position' => 9)));
    $success_story->menu_icon('dashicons-format-chat');
}
<?php

include_once 'CPT.php';
// Work CPT
// create work custom post type
$work = new CPT(array('post_type_name' => 'work', 'singular' => 'Work', 'plural' => 'Work', 'slug' => 'work'), array('supports' => array('author', 'title', 'editor', 'thumbnail', 'excerpt', 'comments'), 'has_archive' => true, 'capability_type' => 'post', 'show_in_menu' => true));
// use  icon for post type
$work->menu_icon("dashicons-portfolio");
$work->register_taxonomy('type');
$work->register_taxonomy('tag');
/*
 * Testimonial CPT
 */
// create testimonial custom post type
$testimonial = new CPT(array('post_type_name' => 'testimonial', 'singular' => 'Testimonial', 'plural' => 'Testimonials', 'slug' => 'testimonials'), array('supports' => array('author', 'title', 'editor', 'thumbnail', 'excerpt', 'comments'), 'has_archive' => true, 'capability_type' => 'post', 'show_in_menu' => true));
// use  icon for post type
$testimonial->menu_icon("dashicons-format-quote");
<?php

$shows = new CPT('show', array('supports' => array('title', 'thumbnail')));
$shows->menu_icon('dashicons-calendar-alt');
Esempio n. 4
0
 public function register_event()
 {
     $event = new CPT('event');
     $event->menu_icon('dashicons-calendar');
     $event->register_taxonomy('event-type');
 }
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');
// 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'];
    switch ($cols) {
        case '1':
Esempio n. 7
0
<?php

/*
 Plugin Name: Hangging Garden of Bali PLugin
 Plugin URI: http://alamaya.com
 Version: 1.0
 Description: This plugin is required for Hangging Garden of Bali template
 Author: The Alamaya Team
 Author URI: http://alamaya.com
 Domain Path: /languages
 License: MIT
*/
require_once 'inc/CPT.php';
$villa = new CPT('villa', array('supports' => array('title', 'editor', 'thumbnail', 'comments', 'excerpt'), 'rewrite' => array('slug' => 'ubudvillas')));
$villa->columns(array('cb' => '<input type="checkbox" />', 'title' => __('Title'), 'date' => __('Date')));
$villa->menu_icon("dashicons-pressthis");
$news = new CPT('news', array('supports' => array('title', 'editor', 'thumbnail', 'comments', 'excerpt')));
$news->columns(array('cb' => '<input type="checkbox" />', 'title' => __('Title'), 'date' => __('Date')));
$news->menu_icon("dashicons-pressthis");
Esempio n. 8
0
<?php

include_once 'CPT.php';
$retreats = new CPT('retreat', array('supports' => array('title', 'editor', 'thumbnail'), 'show_in_menu' => true, 'menu_position' => 5));
$retreats->menu_icon('dashicons-palmtree');
$retreats->register_taxonomy('retreat_type');
$retreats->filters(array('retreat_type'));
$services = new CPT('service', array('supports' => array('title', 'editor', 'thumbnail'), 'show_in_menu' => true, 'menu_position' => 5));
$services->menu_icon('dashicons-share-alt');
<?php

$shows = new CPT('album', array('supports' => array('title', 'thumbnail')));
$shows->menu_icon('dashicons-format-audio');