Esempio n. 1
0
function jkbanners_create_banner_post_type()
{
    $postType = new PostType();
    $postType->name = 'jkbanner';
    $postType->urlSlug = 'banner';
    $postType->labelPlural = 'Banners';
    $postType->labelSingular = 'Banner';
    $postType->excerptTitle = 'URL';
    $postType->excerptHelp = 'URL directed to when clicked';
    $postType->iconCSSContent = '\\f116';
    $postType->create();
}
Esempio n. 2
0
function jksnippets_create_snippet_post_type()
{
    $postType = new PostType();
    $postType->name = 'jksnippet';
    $postType->urlSlug = 'snippet';
    $postType->labelPlural = 'Snippets';
    $postType->labelSingular = 'Snippet';
    $postType->iconCSSContent = '\\f475';
    $postType->supports = array('title', 'page-attributes');
    $postType->addCustomField(['label' => 'Snippet', 'name' => 'snippet', 'type' => 'textarea', 'sanitize' => 'none']);
    $postType->create();
}
 public function run()
 {
     $posttype1 = new PostType();
     $posttype1->post_type = 'doc';
     $posttype1->save();
     $posttype2 = new PostType();
     $posttype2->post_type = 'forum';
     $posttype2->save();
     $posttype3 = new PostType();
     $posttype3->post_type = 'event';
     $posttype3->save();
 }
 /**
  * Retorna uma lista com os banners obitido a partir da consulta com os filtros
  * @return array
  */
 public function searchByTerm($term = false)
 {
     return parent::search($term);
     /*
     $filter = array();
     
     $meta_query = array(
         'relation' => 'AND',
         array(
             'key' => 'mk_banner_bg_position',
             'value' => 60,
             'compare' => '>='
         ),
         array(
             'key' => 'mk_banner_link_texto',
             'value' => $term,
             'compare' => 'LIKE'
         )
     );
     
     $aBanners = parent::customSearch(array(
         'term' => $term,
         'meta_query' => $meta_query,
         'filter' => $filter,
     ));
     
     return $aBanners;
     */
 }
Esempio n. 5
0
 /**
  * Sets the theme object for use in this class and instantiates the post
  * type and related needs
  *
  * @param RockharborThemeBase $theme
  */
 public function __construct($theme = null)
 {
     parent::__construct($theme);
     register_taxonomy('series', $this->name, array('label' => __('Series', 'rockharbor'), 'sort' => true, 'rewrite' => array('slug' => 'series', 'with_front' => false)));
     register_taxonomy('teacher', $this->name, array('label' => __('Teachers', 'rockharbor'), 'sort' => true, 'rewrite' => array('slug' => 'teachers', 'with_front' => false)));
     register_taxonomy_for_object_type('post_tag', $this->name);
     add_shortcode('single-message', array($this, 'singleMessage'));
 }
Esempio n. 6
0
function jkcomics_create_comic_post_type()
{
    $postType = new PostType();
    $postType->name = 'jkcomic';
    $postType->urlSlug = 'comic';
    $postType->labelPlural = 'Comics';
    $postType->labelSingular = 'Comic';
    $postType->excerptTitle = 'Description';
    $postType->excerptHelp = 'Comic Alt Text / Description';
    $postType->iconCSSContent = '\\f161';
    $postType->supports = array('title', 'editor', 'thumbnail', 'page-attributes');
    $postType->create();
}
 /**
  * Display the widget content on the front-end
  *
  * @since 1.0.0
  * @param array $args
  * @param array $instance
  */
 public function widget($args, $instance)
 {
     extract($args);
     // widget options
     $number = !empty($instance['number']) ? absint($instance['number']) : 5;
     // widget query
     $p = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'post_type' => $this->_postType->get('identifier'), 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true)));
     // the loop
     if ($p->have_posts()) {
         echo $before_widget;
         // each post
         while ($p->have_posts()) {
             $p->the_post();
             // display the post
             include plugin_dir_path(__FILE__) . 'Includes/Templates/WidgetPost.php';
         }
         echo $after_widget;
     }
 }
Esempio n. 8
0
 public function add_object_type($post_type)
 {
     if (PostType::validateRealName($post_type)) {
         $this->object_type[] = $post_type;
     }
 }
Esempio n. 9
0
<?php

/*-----------------------------------------------------------------------*/
// FAQ custom post type.
/*-----------------------------------------------------------------------*/
$faq = PostType::make('bks-faqs', 'FAQs', 'FAQ')->set(array('supports' => array('title', 'editor'), 'public' => false, 'show_ui' => true));
/*-----------------------------------------------------------------------*/
// Set default title placeholder text.
/*-----------------------------------------------------------------------*/
$faq->setTitle('Enter your question here...');
Esempio n. 10
0
 /**
  * Create post type repository class.
  *
  * @access public
  *
  * @param  string       $name
  * @param  array|string $args
  */
 public function create_post_type($name, $args = [])
 {
     $this->arguments($name, $args);
     return PostType::init($name, $args);
 }
Esempio n. 11
0
<?php

$team = PostType::make('slhb_team', 'Les équipes', 'équipe')->set(array('public' => true, 'menu_position' => 20, 'supports' => array('title', 'editor'), 'rewrite' => false, 'query_var' => false, 'labels' => ['add_new_item' => 'Ajouter une nouvelle équipe', 'add_new' => 'Ajouter une équipe', 'add_item' => 'Ajouter une équipe', 'all_items' => 'Toutes les équipes', 'edit_item' => 'Modifier une équipe']));
/*-----------------------------------------------------------------------*/
// Team informations
/*-----------------------------------------------------------------------*/
$infos = Metabox::make('Informations sur l\'équipe', $team->get('name'))->set(array(Field::media('profile', ['title' => 'Photo de groupe de l\'équipe ']), Field::select('Niveau', [['Excellence Région', 'Honneur Région', 'Pré-Région', 'Deuxième division']], ['title' => 'Quelle division? ']), Field::collection('gallery')));
Esempio n. 12
0
<?php

$cat = Taxonomy::make('gallery-category', 'galleries', __('Gallery Categories', THEME_TEXT_DOMAIN), __('Gallery Category', THEME_TEXT_DOMAIN))->set(['public' => true, 'show_in_nav_menus' => true, 'hierarchical' => true, 'show_tagcloud' => true, 'show_in_quick_edit' => true]);
$tag = Taxonomy::make('gallery-tag', 'galleries', __('Gallery Tags', THEME_TEXT_DOMAIN), __('Gallery Tag', THEME_TEXT_DOMAIN))->set(['public' => true, 'show_in_nav_menus' => true, 'hierarchical' => true, 'show_tagcloud' => true, 'show_in_quick_edit' => true]);
$galleries = PostType::make('galleries', __('Galleries', THEME_TEXT_DOMAIN), __('Gallery', THEME_TEXT_DOMAIN))->set(['public' => true, 'labels' => ['add_item' => __('Add', THEMOSIS_TEXTDOMAIN)], 'supports' => array('title', 'excerpt', 'thumbnail', 'revisions'), 'taxonomies' => ['gallery-category', 'gallery-tag']]);
$infos = Metabox::make('Informations', $galleries->getSlug())->set(array(Field::collection('images', ['type' => 'images'])));
/*-----------------------------------------------------------------------*/
// Book info validation
/*-----------------------------------------------------------------------*/
//$infos->validate(array(
//    'title'    => array('textfield', 'min:5')
//));
Esempio n. 13
0
<?php

/*-----------------------------------------------------------------------*/
// Match Custom Post
/*-----------------------------------------------------------------------*/
$match = PostType::make('slhb_match', 'Les matchs', 'match')->set(array('public' => true, 'menu_position' => 20, 'supports' => false, 'rewrite' => false, 'query_var' => false, 'labels' => ['add_new' => 'Ajouter un nouveau match', 'add_item' => 'Ajouter un match', 'all_items' => 'Tous les matchs', 'edit_item' => 'Modifier un match']));
/*-----------------------------------------------------------------------*/
// Match informations
/*-----------------------------------------------------------------------*/
$infos = Metabox::make('Informations du match', $match->get('name'))->set(array(Field::date('match_date', ['title' => 'Date du match']), Field::select('match_team_dom', TeamModel::getTeamsArray()), Field::text('match_team_ext', ['title' => 'Equipe à l\'exterieur']), Field::number('score_dom', ['title' => 'Score de l\'équipe à domicile']), Field::number('score_ext', ['title' => 'Score de l\'équipe extérieur'])));
/*-----------------------------------------------------------------------*/
// Match Defaults Values
/*-----------------------------------------------------------------------*/
function slhb_set_title($post_id, $post, $update)
{
    $dateStr = Meta::get($post_id, 'match_date');
    $title = $dateStr . ' - ' . Meta::get($post_id, 'match_team_dom') . ' - ' . Meta::get($post_id, 'match_team_ext');
    $date = date($dateStr);
    //This temporarily removes filter to prevent infinite loops
    remove_action('save_post_slhb_match', __FUNCTION__);
    wp_update_post(array('ID' => $post_id, 'post_title' => $title, 'match_date' => $date));
    //redo filter
    add_action('save_post_slhb_match', __FUNCTION__, 10, 3);
}
add_action('save_post_slhb_match', 'slhb_set_title', 10, 3);
Esempio n. 14
0
<?php

$cat = Taxonomy::make('product-category', 'products', __('Product Categories', THEME_TEXT_DOMAIN), __('Product Category', THEME_TEXT_DOMAIN))->set(['public' => true, 'show_in_nav_menus' => true, 'hierarchical' => true, 'show_tagcloud' => true, 'show_in_quick_edit' => true]);
$tag = Taxonomy::make('product-tag', 'products', __('Product Tags', THEME_TEXT_DOMAIN), __('Product Tag', THEME_TEXT_DOMAIN))->set(['public' => true, 'show_in_nav_menus' => true, 'hierarchical' => true, 'show_tagcloud' => true, 'show_in_quick_edit' => true]);
$products = PostType::make('products', __('Products', THEME_TEXT_DOMAIN), __('Product', THEME_TEXT_DOMAIN))->set(['public' => true, 'show_in_nav_menus' => true, 'show_ui' => TRUE, 'show_in_menu' => TRUE, 'publicly_queryable' => TRUE, 'query_var' => 'products', 'rewrite' => array('slug' => 'products'), 'labels' => ['add_item' => __('Add', THEME_TEXT_DOMAIN)], 'supports' => array('title', 'excerpt', 'thumbnail', 'revisions'), 'taxonomies' => array('product-category', 'product-tag')]);
$infos = Metabox::make('Informations', $products->getSlug())->set(array(Field::textarea('description'), Field::collection('images', ['type' => 'images']), Field::infinite('info', [Field::text('title'), Field::textarea('value')])));
/*-----------------------------------------------------------------------*/
// Book info validation
/*-----------------------------------------------------------------------*/
$infos->validate(array());
 public function __construct($client_id, $tag)
 {
     PostType::setup();
     Fetch::setup();
     APIEndpoint::create($client_id, $tag);
 }
Esempio n. 16
0
 /**
  * Constructor. Set up the properties.
  *
  * @param PostType $post_type Post type model.
  * @param MetaBox  $meta_box  Meta box model.
  */
 public function __construct(PostType $post_type, MetaBox $meta_box)
 {
     $this->post_type = $post_type->get_post_type();
     $this->meta_key = $meta_box->get_meta_key();
 }
 public function PostType()
 {
     return PostType::getInstance();
 }
Esempio n. 18
0
 /**
  * Register custom post types.
  *
  * @param array $post_types
  */
 public static function post_types(array $post_types)
 {
     foreach ($post_types as $post_type) {
         PostType::register($post_type['name'], $post_type['slug'], $post_type['args']);
     }
 }
Esempio n. 19
0
<?php

$cat = Taxonomy::make('product-category', 'products', __('Product Categories', THEME_TEXT_DOMAIN), __('Product Category', THEME_TEXT_DOMAIN))->set(['public' => true, 'show_in_nav_menus' => true, 'hierarchical' => true, 'show_tagcloud' => true, 'show_in_quick_edit' => true]);
$tag = Taxonomy::make('product-tag', 'products', __('Product Tags', THEME_TEXT_DOMAIN), __('Product Tag', THEME_TEXT_DOMAIN))->set(['public' => true, 'show_in_nav_menus' => true, 'hierarchical' => true, 'show_tagcloud' => true, 'show_in_quick_edit' => true]);
$products = PostType::make('products', __('Products', THEME_TEXT_DOMAIN), __('Product', THEME_TEXT_DOMAIN))->set(['public' => true, 'labels' => ['add_item' => __('Add', THEME_TEXT_DOMAIN)], 'supports' => array('title', 'excerpt', 'thumbnail', 'revisions'), 'taxonomies' => array('product-category', 'product-tag')]);
$infos = Metabox::make('Informations', $products->getSlug())->set(array(Field::textarea('description'), Field::collection('images', ['type' => 'images']), Field::infinite('info', [Field::text('title'), Field::textarea('value')])));
/*-----------------------------------------------------------------------*/
// Book info validation
/*-----------------------------------------------------------------------*/
$infos->validate(array());
Esempio n. 20
0
 /**
  * Set up timeslot custom post type
  *
  * @private
  */
 private static function _set_up_timeslot()
 {
     PostType::make('timeslot', 'Time Slots', 'Time Slot')->set();
     $fields = array(Field::select('timeslot_venue', array(array('none' => __('- None -')) + VenueModel::venueSelection()), array('title' => __('Venue'))), Field::select('timeslot_user', array(array('none' => __('- None -')) + UserModel::userSelection()), array('title' => __('User'))), Field::date('date', array('title' => 'Date')), Field::select('time_from', array(Config::get('application.timeslots')), array('title' => __('Start at'))), Field::select('time_to', array(Config::get('application.timeslots')), array('title' => __('Finish at'))));
     Metabox::make('Options', 'timeslot')->set($fields);
 }
Esempio n. 21
0
<?php

/*-----------------------------------------------------------------------*/
// Custom post type - bks-books
/*-----------------------------------------------------------------------*/
$books = PostType::make('bks-books', 'Books', 'Book')->set(array('public' => true, 'rewrite' => array('slug' => 'books'), 'supports' => array('title', 'editor', 'excerpt', 'thumbnail')));
/*-----------------------------------------------------------------------*/
// Book informations
/*-----------------------------------------------------------------------*/
$infos = Metabox::make('Informations', $books->getSlug())->set(array(Field::text('author'), Field::media('promo-image', array('title' => 'Image promotion', 'info' => 'Image used on home page in order to promote the book.')), Field::text('color', array('info' => 'Insert a hexadecimal color value: <b>#cdcdcd</b>'))));
/*-----------------------------------------------------------------------*/
// Book info validation
/*-----------------------------------------------------------------------*/
$infos->validate(array('author' => array('textfield', 'min:5'), 'color' => array('color')));
Esempio n. 22
0
 /**
  * Update Post type datum.
  *
  * @param array $request Contains all data in $_REQUEST
  *
  * @since 3.0.0
  */
 protected function updatePostType($request)
 {
     //Admin panel
     if (!TTO_IS_ADMIN) {
         return;
     }
     //Make actions
     $posttype = new PostType(true, false);
     $posttype->makeActions($request);
 }
Esempio n. 23
0
 /**
  * Registers and builds admin interface for a custom post type.
  * @param type $config
  * @param type $method
  */
 public function addPostType($config, $method = self::FROM_FILE)
 {
     $configData = self::getConfigObject($config, $method);
     PostType::createFromConfig($configData, $this->templateHandler);
 }
Esempio n. 24
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $postTypes = PostType::all();
     $post = Post::find($id);
     $post->load('user', 'postType');
     return View::make('posts.edit')->with('post', $post)->with('postTypes', $postTypes);
 }
Esempio n. 25
0
            wp_enqueue_style('wpes_overwrite', $template_uri . DS . 'wpes.css');
        }
    }
    /**
     * 管理画面CSS読み込み
     */
    function admin_event_style()
    {
        global $post_type;
        if ($post_type == POST_TYPE) {
            wp_enqueue_style('wpes_jquery-ui-custom', WP_PLUGIN_URL . DS . PLUGIN_DIR . DS . CSS_DIR . DS . 'smoothness' . DS . 'jquery-ui-1.10.3.custom.min.css');
            wp_enqueue_style('wpes_jquery-ui-timepicker', WP_PLUGIN_URL . DS . PLUGIN_DIR . DS . CSS_DIR . DS . 'jquery-ui-timepicker-addon.css');
        }
    }
    /**
     * 管理画面JS読み込み
     */
    function admin_event_script()
    {
        global $post_type;
        if ($post_type == POST_TYPE) {
            wp_enqueue_script('wpes_jquery-ui-timepicker', WP_PLUGIN_URL . DS . PLUGIN_DIR . DS . JS_DIR . DS . 'jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker'));
            wp_enqueue_script('wpes_common', WP_PLUGIN_URL . DS . PLUGIN_DIR . DS . JS_DIR . DS . 'common.js');
        }
    }
}
EventSchedule::_init();
Admin::_init();
Shortcode::_init();
PostType::_init();
$WPES = new TemplateTag();
Esempio n. 26
0
 /**
  * Sets the theme object for use in this class and instantiates the Staff post
  * type and related needs
  *
  * @param RockharborThemeBase $theme
  */
 public function __construct($theme = null)
 {
     parent::__construct($theme);
     register_taxonomy('department', $this->name, array('label' => __('Department', 'rockharbor'), 'sort' => true, 'rewrite' => array('slug' => 'department')));
 }
 public function __construct()
 {
     $args = array('labels' => array('name' => __('Series'), 'singular_name' => __('Series')), 'public' => true, 'has_archive' => true, 'show_ui' => TRUE, 'rewrite' => array('slug' => 'series'), 'supports' => array('title', 'editor', 'author'), 'taxonomies' => array(), 'hierarchical' => TRUE);
     parent::__construct($args);
 }
Esempio n. 28
0
 /**
  * Sets the theme object for use in this class and instantiates the post
  * type and related needs
  *
  * @param RockharborThemeBase $theme
  */
 public function __construct($theme = null)
 {
     parent::__construct($theme);
     register_taxonomy('curriculum_category', $this->name, array('label' => __('Category', 'rockharbor'), 'sort' => true, 'rewrite' => array('slug' => 'curriculum-category', 'with_front' => false)));
     register_taxonomy_for_object_type('post_tag', $this->name);
 }
Esempio n. 29
0
 public function registerPostTypes()
 {
     $postTypeFactory = PostType::getInstance();
     $postTypeFactory->loadPostType($this->getPostTypeClasses());
     $postTypeFactory->init();
 }