当前位置: 首页>>代码示例>>PHP>>正文


PHP post_type_exists函数代码示例

本文整理汇总了PHP中post_type_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP post_type_exists函数的具体用法?PHP post_type_exists怎么用?PHP post_type_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了post_type_exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register_post_types

 public static function register_post_types()
 {
     if (post_type_exists(Follow_Up_Emails::$post_type)) {
         return;
     }
     register_post_type(Follow_Up_Emails::$post_type, array('labels' => array('name' => __('Follow-Up Emails', 'follow_up_emails'), 'singular_name' => __('Follow-Up Email', 'follow_up_emails'), 'menu_name' => _x('Follow-Up Emails', 'Admin menu name', 'follow_up_emails'), 'add_new' => __('Add Email', 'follow_up_emails'), 'add_new_item' => __('Add New Email', 'follow_up_emails'), 'edit' => __('Edit', 'follow_up_emails'), 'edit_item' => __('Edit Email', 'follow_up_emails'), 'new_item' => __('New Follow-Up Email', 'follow_up_emails'), 'view' => __('View Email', 'follow_up_emails'), 'view_item' => __('View Email', 'follow_up_emails'), 'search_items' => __('Search Follow-Up Emails', 'follow_up_emails'), 'not_found' => __('No Emails found', 'follow_up_emails'), 'not_found_in_trash' => __('No Emails found in trash', 'follow_up_emails')), 'public' => false, 'show_ui' => true, 'show_in_menu' => false, 'show_in_admin_bar' => true, 'hierarchical' => false, 'supports' => array('title', 'editor')));
 }
开发者ID:bself,项目名称:nuimage-wp,代码行数:7,代码来源:class-fue-post-types.php

示例2: register_post_types

 public function register_post_types()
 {
     parent::register_post_types();
     if (!post_type_exists('wp-parser-constant')) {
         register_post_type('wp-parser-constant', array('has_archive' => 'constants', 'label' => __('Constants'), 'public' => true, 'rewrite' => array('feeds' => false, 'slug' => 'constant', 'with_front' => false), 'supports' => array('editor', 'excerpt', 'title')));
     }
 }
开发者ID:23r9i0,项目名称:sublime,代码行数:7,代码来源:class-plugin.php

示例3: normalize_field

 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $field = wp_parse_args($field, array('post_type' => 'post', 'field_type' => 'select_advanced', 'parent' => false, 'query_args' => array()));
     /**
      * Set default placeholder
      * - If multiple post types: show 'Select a post'
      * - If single post type: show 'Select a %post_type_name%'
      */
     if (empty($field['placeholder'])) {
         $label = __('Select a post', 'meta-box');
         if (is_string($field['post_type']) && post_type_exists($field['post_type'])) {
             $post_type_object = get_post_type_object($field['post_type']);
             $label = sprintf(__('Select a %s', 'meta-box'), $post_type_object->labels->singular_name);
         }
         $field['placeholder'] = $label;
     }
     if ($field['parent']) {
         $field['multiple'] = false;
         $field['field_name'] = 'parent_id';
     }
     $field['query_args'] = wp_parse_args($field['query_args'], array('post_type' => $field['post_type'], 'post_status' => 'publish', 'posts_per_page' => -1));
     switch ($field['field_type']) {
         case 'select':
             return RWMB_Select_Field::normalize_field($field);
             break;
         case 'select_advanced':
         default:
             return RWMB_Select_Advanced_Field::normalize_field($field);
     }
 }
开发者ID:ryanlabelle,项目名称:meta-box,代码行数:37,代码来源:post.php

示例4: init

 public static function init()
 {
     global $ClevernessToDoList, $CTDL_Frontend_Checklist, $CTDL_Frontend_Admin, $CTDL_templates, $CTDL_Dashboard_Widget;
     if (is_admin()) {
         self::check_for_upgrade();
     }
     $general_options = get_option('CTDL_general') ? get_option('CTDL_general') : array();
     $advanced_options = get_option('CTDL_advanced') ? get_option('CTDL_advanced') : array();
     $permissions_options = get_option('CTDL_permissions') ? get_option('CTDL_permissions') : array();
     self::$settings = array_merge($general_options, $advanced_options, $permissions_options);
     self::$dashboard_settings = get_option('CTDL_dashboard_settings');
     self::include_files();
     if (!post_type_exists('todo')) {
         self::setup_custom_post_type();
     }
     if (!taxonomy_exists('todocategories')) {
         self::create_taxonomies();
     }
     self::call_wp_hooks();
     $ClevernessToDoList = new ClevernessToDoList();
     $CTDL_templates = new CTDL_Template_Loader();
     if (is_admin()) {
         new CTDL_Settings();
         $CTDL_Dashboard_Widget = new CTDL_Dashboard_Widget();
     }
     $CTDL_Frontend_Admin = new CTDL_Frontend_Admin();
     $CTDL_Frontend_Checklist = new CTDL_Frontend_Checklist();
     new CTDL_Frontend_List();
 }
开发者ID:abenamer,项目名称:thereveal,代码行数:29,代码来源:cleverness-to-do-list-loader.class.php

示例5: ddw_gle_admin_help_zigzagpress

/**
 * Add optional help tab content for supported child themes by ZigZagPress.
 *
 * @since 1.6.0
 *
 * @uses  ddw_gle_plugin_get_data()
 * @uses  post_type_exists()
 * @uses  CHILD_THEME_NAME
 */
function ddw_gle_admin_help_zigzagpress()
{
    echo '<h3>' . __('Plugin: Genesis Layout Extras', 'genesis-layout-extras') . ' <small>v' . esc_attr(ddw_gle_plugin_get_data('Version')) . '</small></h3>';
    echo '<h4>' . __('Custom Post Types by Child Themes', 'genesis-layout-extras') . ' &mdash; ' . __('by StudioPress', 'genesis-layout-extras') . '</h4>';
    /** Child Themes by ZigZagPress: Bijou, Engrave, Eshop, Megalithe, Single, Solo, Tequila, Vanilla */
    if (post_type_exists('portfolio')) {
        if (CHILD_THEME_NAME == 'Megalithe') {
            $gle_zzp_theme_check = 'Megalithe';
        } elseif (CHILD_THEME_NAME == 'Engrave Theme') {
            $gle_zzp_theme_check = 'Engrave';
        } elseif (CHILD_THEME_NAME == 'Vanilla') {
            $gle_zzp_theme_check = 'Vanilla';
        } elseif (CHILD_THEME_NAME == 'Solo') {
            $gle_zzp_theme_check = 'Solo';
        } elseif (CHILD_THEME_NAME == 'Bijou') {
            $gle_zzp_theme_check = 'Bijou';
        } elseif (CHILD_THEME_NAME == 'Eshop') {
            $gle_zzp_theme_check = 'Eshop';
        } elseif (CHILD_THEME_NAME == 'Single') {
            $gle_zzp_theme_check = 'Single';
        } elseif (CHILD_THEME_NAME == 'Tequila') {
            $gle_zzp_theme_check = 'Tequila';
        } elseif (CHILD_THEME_NAME == 'Prestige') {
            $gle_zzp_theme_check = 'Prestige';
        } elseif (CHILD_THEME_NAME == 'Neo') {
            $gle_zzp_theme_check = 'Neo';
        }
        echo '<p>' . sprintf(__('Child Theme: %s by ZigZagPress', 'genesis-layout-extras'), $gle_zzp_theme_check) . '</p>' . '<ul>' . '<li>' . __('Portfolio Post Type Layout (archive)', 'genesis-layout-extras') . '</li>' . '<li>' . __('Portfolio Categories Taxonomy Layout', 'genesis-layout-extras') . '</li>' . '</ul>';
    }
    // end-if ZigZagPress check
}
开发者ID:jonpetersen,项目名称:PHTC,代码行数:40,代码来源:gle-admin-help-zigzagpress.php

示例6: updateRaw

 protected function updateRaw()
 {
     if (!post_type_exists($this->name)) {
         $this->register();
     }
     $this->raw = get_post_type_object($this->name);
 }
开发者ID:amekusa,项目名称:WPELib,代码行数:7,代码来源:Type.php

示例7: init

 /**
  * Plugin Loader init
  * @static
  * @since 1.0
  */
 public static function init()
 {
     global $PostPlannerSettings;
     self::check_for_upgrade();
     $general_options = get_option('PostPlanner_general') ? get_option('PostPlanner_general') : array();
     $advanced_options = get_option('PostPlanner_advanced') ? get_option('PostPlanner_advanced') : array();
     self::$settings = array_merge($general_options, $advanced_options);
     self::$statuses = self::setup_statuses();
     if (PostPlanner_Loader::check_plugin_access() == false) {
         return;
     }
     if (PostPlanner_Loader::$settings['checklist'] == 1) {
         self::$checklist = get_option('PostPlanner_checklist');
     }
     self::include_files();
     if (!post_type_exists('planner')) {
         self::setup_custom_post_type();
     }
     if (!taxonomy_exists('plannercategories')) {
         self::create_taxonomies();
     }
     $PostPlannerSettings = new PostPlanner_Settings();
     if (!defined('PP_CTDL')) {
         if (in_array('cleverness-to-do-list/cleverness-to-do-list.php', apply_filters('active_plugins', get_option('active_plugins'))) && PostPlanner_Loader::$settings['ctdl'] == 1) {
             define('PP_CTDL', true);
         } else {
             define('PP_CTDL', false);
         }
     }
     self::setup_metaboxes();
     self::call_wp_hooks();
     new PostPlanner_Dashboard_Widget();
 }
开发者ID:montreyw,项目名称:Theme-Redesign-and-SEO-Overhaul,代码行数:38,代码来源:post-planner-loader.class.php

示例8: basey_page_query

/**
 * Allows pages to be publicly queryable
 * @return void
 */
function basey_page_query()
{
    if (post_type_exists('page')) {
        global $wp_post_types;
        $wp_post_types['page']->publicly_queryable = true;
    }
}
开发者ID:kokokokokokoko,项目名称:basey-theme,代码行数:11,代码来源:search.php

示例9: is_active

 public static function is_active($data)
 {
     $is_active = false;
     if (isset($_REQUEST['flow_page'])) {
         $is_active = $_REQUEST['flow_page'] == $data['page_slug'];
     } elseif (!empty($data)) {
         global $post, $current_user, $pagenow;
         $post = !$post ? isset($_REQUEST['post']) ? get_post($_REQUEST['post']) : false : $post;
         foreach ($data as $key => $value) {
             $value = is_array($value) ? array_filter($value) : $value;
             if (!empty($value)) {
                 switch ($key) {
                     case 'post_type':
                         $is_active = ($post ? $post->post_type : (isset($_REQUEST['post_type']) && post_type_exists($_REQUEST['post_type']) ? $_REQUEST['post_type'] : null)) == $value;
                         break;
                     case 'page':
                         $is_active = is_array($value) && in_array($pagenow, $value) || is_string($value) && $pagenow == $value;
                         break;
                 }
             }
         }
     }
     if ($is_active) {
         $data['active'] = true;
     }
     return $data;
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:27,代码来源:class-piklist-workflow.php

示例10: custom_content

 function custom_content()
 {
     if (!post_type_exists($this->prefix . 'media')) {
         $args = array('supports' => array(), 'hierarchical' => false, 'public' => false, 'show_ui' => false, 'show_in_menu' => false, 'show_in_nav_menus' => false, 'show_in_admin_bar' => false, 'can_export' => true, 'has_archive' => false, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => $this->prefix . 'media');
         register_post_type($this->prefix . 'media', $args);
     }
 }
开发者ID:Artgorae,项目名称:wp-artgorae,代码行数:7,代码来源:ig-uploader.php

示例11: check_version_update

 static function check_version_update()
 {
     //check if the apto_sort post type exists, oterwise call the function to register it
     if (!post_type_exists('apto_sort')) {
         APTO_register_post_types();
     }
     //check on the database version and if need update
     $settings = APTO_functions::get_settings();
     //check the table
     if (!isset($settings['database_version']) || version_compare($settings['database_version'], APTO_DB_VERSION, '<')) {
         self::update_tables();
     }
     //check for settings
     if (!isset($settings['plugin_version']) || version_compare($settings['plugin_version'], 1, '<=')) {
         self::create_settings();
     } else {
         if (version_compare($settings['plugin_version'], APTO_VERSION, '<')) {
             self::update_from_old_version_settings();
         }
     }
     //refetch the latest settings dataset
     $settings = APTO_functions::get_settings();
     //use a later filter to import from an older format
     if (isset($settings['schedule_data_import']) && $settings['schedule_data_import'] === TRUE) {
         unset($settings['schedule_data_import']);
         add_action('admin_menu', array(__CLASS__, 'old_version_data_import'), 98);
         APTO_functions::update_settings($settings);
     }
     //run a later filter to create sorts for every post type
     if (isset($settings['schedule_create_default_sorts']) && $settings['schedule_create_default_sorts'] === TRUE) {
         unset($settings['schedule_create_default_sorts']);
         add_action('admin_menu', array(__CLASS__, 'create_default_sorts'), 98);
         APTO_functions::update_settings($settings);
     }
 }
开发者ID:b0123498765,项目名称:template-wordpress,代码行数:35,代码来源:apto_updater-class.php

示例12: ddw_genesis_layout_extras_box_zigzagpress

/**
 * Third meta box - optional: setting up the setting fields & labels.
 *    For supported 'ZigZagPress' child themes with CPTs.
 *
 * @since 1.6.0
 *
 * @uses  post_type_exists()
 * @uses  ddw_genesis_layout_extras_option()
 * @uses  CHILD_THEME_NAME
 *
 * @param $gle_zzp_theme_check
 * @param $gle_zzp_theme
 */
function ddw_genesis_layout_extras_box_zigzagpress()
{
    /** Description - user info: Child Theme generated special Custom Post Type sections */
    echo '<h4>' . __('Special Custom Post Type Sections', 'genesis-layout-extras') . '</h4>';
    echo '<p><span class="description">' . __('Here you can set up a <strong>default</strong> layout option for various extra archive pages generated by Custom Post Types which were set by child themes.', 'genesis-layout-extras') . ' ' . sprintf(__('%1$sGenesis Default%2$s in the drop-down menus below always means the chosen default layout option in the regular <a href="%3$s">Genesis layout settings</a>.', 'genesis-layout-extras'), '<code style="font-style: normal; color: #333;">', '</code>', admin_url('admin.php?page=genesis#genesis-theme-settings-layout')) . '</span></p>';
    /** Child Themes by ZigZagPress: Bijou, Engrave, Eshop, Megalithe, Single, Solo, Tequila, Vanilla */
    if (post_type_exists('portfolio')) {
        if (CHILD_THEME_NAME == 'Megalithe') {
            $gle_zzp_theme_check = 'Megalithe';
        } elseif (CHILD_THEME_NAME == 'Engrave Theme') {
            $gle_zzp_theme_check = 'Engrave';
        } elseif (CHILD_THEME_NAME == 'Vanilla') {
            $gle_zzp_theme_check = 'Vanilla';
        } elseif (CHILD_THEME_NAME == 'Solo') {
            $gle_zzp_theme_check = 'Solo';
        } elseif (CHILD_THEME_NAME == 'Bijou') {
            $gle_zzp_theme_check = 'Bijou';
        } elseif (CHILD_THEME_NAME == 'Eshop') {
            $gle_zzp_theme_check = 'Eshop';
        } elseif (CHILD_THEME_NAME == 'Single') {
            $gle_zzp_theme_check = 'Single';
        } elseif (CHILD_THEME_NAME == 'Tequila') {
            $gle_zzp_theme_check = 'Tequila';
        }
        $gle_zzp_theme = sprintf(__('Child Theme: %s by ZigZagPress', 'genesis-layout-extras'), $gle_zzp_theme_check);
        echo '<hr class="div" />';
        echo '<h4>' . $gle_zzp_theme . '</h4>';
        ddw_genesis_layout_extras_option(__('Portfolio Post Type Layout (archive)', 'genesis-layout-extras') . ': ', 'ddw_genesis_layout_cpt_child_portfolio');
        ddw_genesis_layout_extras_option(__('Portfolio Categories Taxonomy Layout', 'genesis-layout-extras') . ': ', 'ddw_genesis_layout_cpt_child_portfolio_category');
        ddw_gle_save_button();
    }
    // end-if zigzagpress portfolio check
}
开发者ID:jonpetersen,项目名称:PHTC,代码行数:46,代码来源:gle-admin-options-zigzagpress.php

示例13: fluxi_register_post_type

/**
 * Create a custom post type
 */
function fluxi_register_post_type($post_type, $label_plural, $args, $feminin = false, $labels = array())
{
    // Verify if the post_type exist
    if (post_type_exists($post_type) === true) {
        return false;
    }
    // Singular post_type label
    $label = isset($labels['singular_name']) ? $labels['singular_name'] : substr($label_plural, 0, -1);
    // Default parameters
    $default_labels = array('name' => $label_plural, 'singular_name' => $label, 'menu_name' => $label_plural, 'all_items' => 'Liste', 'add_new' => __('Ajouter'), 'add_new_item' => 'Ajouter un nouveau ' . strtolower($label), 'edit_item' => 'Modifier un ' . strtolower($label), 'new_item' => 'Nouveau ' . strtolower($label), 'view_item' => 'Voir', 'search_items' => 'Chercher un ' . strtolower($label), 'not_found' => 'Aucun ' . strtolower($label) . ' trouvé.', 'not_found_in_trash' => 'Aucun ' . strtolower($label) . ' trouvé dans la corbeille.');
    // Feminin
    if ($feminin !== false) {
        foreach ($default_labels as $key => $val) {
            $default_labels[$key] = str_replace(array(' un ', ' nouveau', 'Nouveau ', 'Aucun ', ' trouvé'), array(' une ', ' nouvelle', 'Nouvelle ', 'Aucune ', ' trouvée'), $val);
        }
    }
    // Overwrite default label parameters
    foreach ($labels as $key => $val) {
        $default_labels[$key] = $val;
    }
    $default_args = array('labels' => $default_labels, 'public' => true, 'show_ui' => true, 'show_in_rest' => false, 'rest_base' => '', 'show_in_menu' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => array('slug' => $post_type, 'with_front' => true), 'query_var' => true, 'supports' => array('title', 'editor', 'author'), 'exclude_from_search' => false, 'has_archive' => false, 'map_meta_cap' => true, 'taxonomies' => array('category', 'post_tag'));
    // Overwrite default parameters
    foreach ($args as $key => $val) {
        $default_args[$key] = $val;
    }
    // Register the post type
    return register_post_type($post_type, $default_args);
}
开发者ID:fluxinetwork,项目名称:fluxi_wp_start,代码行数:31,代码来源:utils.php

示例14: __construct

 /**
  * Constructor. Builds our CPT.
  * @since 0.1.0
  * @param mixed  $cpt           Array with Singular, Plural, and Registered (slug)
  * @param array  $arg_overrides CPT registration override arguments
  */
 public function __construct(array $cpt, $arg_overrides = array())
 {
     if (!is_array($cpt)) {
         wp_die(__('It is required to pass a single, plural and slug string to CPT_Core', 'cpt-core'));
     }
     if (!isset($cpt[0], $cpt[1], $cpt[2])) {
         wp_die(__('It is required to pass a single, plural and slug string to CPT_Core', 'cpt-core'));
     }
     if (!is_string($cpt[0]) || !is_string($cpt[1]) || !is_string($cpt[2])) {
         wp_die(__('It is required to pass a single, plural and slug string to CPT_Core', 'cpt-core'));
     }
     if (post_type_exists($cpt[2])) {
         return;
     }
     $this->singular = $cpt[0];
     $this->plural = !isset($cpt[1]) || !is_string($cpt[1]) ? $cpt[0] . 's' : $cpt[1];
     $this->post_type = !isset($cpt[2]) || !is_string($cpt[2]) ? sanitize_title($this->plural) : $cpt[2];
     $this->arg_overrides = (array) $arg_overrides;
     // load text domain
     add_action('plugins_loaded', array($this, 'l10n'), 5);
     add_action('init', array($this, 'register_post_type'));
     add_filter('post_updated_messages', array($this, 'messages'));
     add_filter('manage_edit-' . $this->post_type . '_columns', array($this, 'columns'));
     add_filter('manage_edit-' . $this->post_type . '_sortable_columns', array($this, 'sortable_columns'));
     // Different column registration for pages/posts
     $h = isset($arg_overrides['hierarchical']) && $arg_overrides['hierarchical'] ? 'pages' : 'posts';
     add_action("manage_{$h}_custom_column", array($this, 'columns_display'), 10, 2);
     add_filter('enter_title_here', array($this, 'title'));
     add_action('deactivated_plugin', array($this, 'flush_permalink'), 10, 2);
 }
开发者ID:CodeAtCode,项目名称:Glossary,代码行数:36,代码来源:CPT_Core.php

示例15: __construct

 /**
  * Custom post type
  *
  * @param   array   $cpt
  */
 function __construct($cpt)
 {
     $this->the_post_type = Riesma::slugify($cpt['post_type']);
     $this->labels = $cpt['labels'];
     // Setup all labels
     /*
     $lang = get_language_function_still_to_write();
     // Dutch
     if ( $lang == 'nl' ) {
     
     	if ( is_array( $this->labels ) ) {
     		$this->name     = Riesma::titleify( $this->labels['name'] );
     		$this->plural   = Riesma::titleify( $this->labels['plural'] );
     		$this->singular = Riesma::titleify( $this->labels['singular'] );
     	}
     	else {
     		$this->name     = Riesma::titleify( $this->labels . 's' );
     		$this->plural   = Riesma::titleify( $this->labels . 's' );
     		$this->singular = Riesma::titleify( $this->labels );
     	}
     
     	$this->hierarchical = !empty( $cpt['hierarchical'] ) ? $cpt['hierarchical'] : false;
     	$this->taxonomies   = !empty( $cpt['taxonomies'] ) ? $cpt['taxonomies'] : false;
     	$this->supports     = !empty( $cpt['supports'] ) ? $cpt['supports'] : $this->supports_default;
     	$this->slug         = Riesma::slugify( $this->name );
     	$this->icon         = Riesma::iconify( $this->the_post_type );
     }
     
     // English
     else {
     
     	if ( is_array( $this->labels ) ) {
     		$this->name          = Riesma::titleify( $this->labels['name'] );
     		$this->singular_name = Riesma::titleify( $this->labels['singular'] );
     		$this->plural        = Riesma::textify( $this->labels['plural'] );
     		$this->singular      = Riesma::textify( $this->labels['singular'] );
     	}
     	else {
     		$this->name          = Riesma::titleify( Riesma::pluralify( $this->labels ) );
     		$this->singular_name = Riesma::titleify( $this->labels );
     		$this->plural        = Riesma::textify( Riesma::pluralify( $this->labels ) );
     		$this->singular      = Riesma::textify( $this->labels );
     	}
     }
     */
     $this->name = Riesma::titleify($this->labels['name']);
     $this->singular_name = Riesma::titleify($this->labels['singular']);
     $this->plural = Riesma::textify($this->labels['plural']);
     $this->singular = Riesma::textify($this->labels['singular']);
     $this->hierarchical = !empty($cpt['hierarchical']) ? $cpt['hierarchical'] : false;
     $this->taxonomies = !empty($cpt['taxonomies']) ? $cpt['taxonomies'] : false;
     $this->supports = !empty($cpt['supports']) ? $cpt['supports'] : $this->supports_default;
     $this->slug = Riesma::slugify($this->name);
     $this->icon = Riesma::iconify($this->the_post_type);
     // Add the post type, if it does not exist yet
     if (!post_type_exists($this->the_post_type)) {
         add_action('init', array($this, 'register_post_type'));
         add_action('init', array($this, 'register_taxonomy'));
     }
 }
开发者ID:riesma,项目名称:wordpress-setup-plugin,代码行数:65,代码来源:class.posttype.php


注:本文中的post_type_exists函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。