• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP post_type_exists函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: avia_temp_products

function avia_temp_products()
{
    if (post_type_exists('product')) {
        return false;
    }
    $product_base = $base_slug = $category_base = "";
    register_taxonomy('product_cat', array('product'), array('hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Categories', 'woothemes'), 'labels' => array('name' => __('Categories', 'woothemes'), 'singular_name' => __('Product Category', 'woothemes'), 'search_items' => __('Search Product Categories', 'woothemes'), 'all_items' => __('All Product Categories', 'woothemes'), 'parent_item' => __('Parent Product Category', 'woothemes'), 'parent_item_colon' => __('Parent Product Category:', 'woothemes'), 'edit_item' => __('Edit Product Category', 'woothemes'), 'update_item' => __('Update Product Category', 'woothemes'), 'add_new_item' => __('Add New Product Category', 'woothemes'), 'new_item_name' => __('New Product Category Name', 'woothemes')), 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => $category_base . _x('product-category', 'slug', 'woothemes'), 'with_front' => false)));
    register_taxonomy('product_tag', array('product'), array('hierarchical' => false, 'label' => __('Tags', 'woothemes'), 'labels' => array('name' => __('Tags', 'woothemes'), 'singular_name' => __('Product Tag', 'woothemes'), 'search_items' => __('Search Product Tags', 'woothemes'), 'all_items' => __('All Product Tags', 'woothemes'), 'parent_item' => __('Parent Product Tag', 'woothemes'), 'parent_item_colon' => __('Parent Product Tag:', 'woothemes'), 'edit_item' => __('Edit Product Tag', 'woothemes'), 'update_item' => __('Update Product Tag', 'woothemes'), 'add_new_item' => __('Add New Product Tag', 'woothemes'), 'new_item_name' => __('New Product Tag Name', 'woothemes')), 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => $category_base . _x('product-tag', 'slug', 'woothemes'), 'with_front' => false)));
    register_post_type("product", array('labels' => array('name' => __('Products', 'woothemes'), 'singular_name' => __('Product', 'woothemes'), 'add_new' => __('Add Product', 'woothemes'), 'add_new_item' => __('Add New Product', 'woothemes'), 'edit' => __('Edit', 'woothemes'), 'edit_item' => __('Edit Product', 'woothemes'), 'new_item' => __('New Product', 'woothemes'), 'view' => __('View Product', 'woothemes'), 'view_item' => __('View Product', 'woothemes'), 'search_items' => __('Search Products', 'woothemes'), 'not_found' => __('No Products found', 'woothemes'), 'not_found_in_trash' => __('No Products found in trash', 'woothemes'), 'parent' => __('Parent Product', 'woothemes')), 'description' => __('This is where you can add new products to your store.', 'woothemes'), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'publicly_queryable' => true, 'exclude_from_search' => false, 'hierarchical' => true, 'rewrite' => array('slug' => $product_base, 'with_front' => false), 'query_var' => true, 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'comments'), 'has_archive' => $base_slug, 'show_in_nav_menus' => false));
    register_post_type("product_variation", array('labels' => array('name' => __('Variations', 'woothemes'), 'singular_name' => __('Variation', 'woothemes'), 'add_new' => __('Add Variation', 'woothemes'), 'add_new_item' => __('Add New Variation', 'woothemes'), 'edit' => __('Edit', 'woothemes'), 'edit_item' => __('Edit Variation', 'woothemes'), 'new_item' => __('New Variation', 'woothemes'), 'view' => __('View Variation', 'woothemes'), 'view_item' => __('View Variation', 'woothemes'), 'search_items' => __('Search Variations', 'woothemes'), 'not_found' => __('No Variations found', 'woothemes'), 'not_found_in_trash' => __('No Variations found in trash', 'woothemes'), 'parent' => __('Parent Variation', 'woothemes')), 'public' => true, 'show_ui' => false, 'capability_type' => 'post', 'publicly_queryable' => true, 'exclude_from_search' => true, 'hierarchical' => true, 'rewrite' => false, 'query_var' => true, 'supports' => array('title', 'editor', 'custom-fields', 'page-attributes', 'thumbnail'), 'show_in_nav_menus' => false));
    register_taxonomy('product_type', array('product'), array('hierarchical' => false, 'show_ui' => false, 'query_var' => true, 'show_in_nav_menus' => false));
    register_post_type("shop_order", array('labels' => array('name' => __('Orders', 'woothemes'), 'singular_name' => __('Order', 'woothemes'), 'add_new' => __('Add Order', 'woothemes'), 'add_new_item' => __('Add New Order', 'woothemes'), 'edit' => __('Edit', 'woothemes'), 'edit_item' => __('Edit Order', 'woothemes'), 'new_item' => __('New Order', 'woothemes'), 'view' => __('View Order', 'woothemes'), 'view_item' => __('View Order', 'woothemes'), 'search_items' => __('Search Orders', 'woothemes'), 'not_found' => __('No Orders found', 'woothemes'), 'not_found_in_trash' => __('No Orders found in trash', 'woothemes'), 'parent' => __('Parent Orders', 'woothemes')), 'description' => __('This is where store orders are stored.', 'woothemes'), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'publicly_queryable' => false, 'exclude_from_search' => true, 'show_in_menu' => 'woocommerce', 'hierarchical' => false, 'show_in_nav_menus' => false, 'rewrite' => false, 'query_var' => true, 'supports' => array('title', 'comments', 'custom-fields'), 'has_archive' => false));
    register_taxonomy('shop_order_status', array('shop_order'), array('hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'labels' => array('name' => __('Order statuses', 'woothemes'), 'singular_name' => __('Order status', 'woothemes'), 'search_items' => __('Search Order statuses', 'woothemes'), 'all_items' => __('All  Order statuses', 'woothemes'), 'parent_item' => __('Parent Order status', 'woothemes'), 'parent_item_colon' => __('Parent Order status:', 'woothemes'), 'edit_item' => __('Edit Order status', 'woothemes'), 'update_item' => __('Update Order status', 'woothemes'), 'add_new_item' => __('Add New Order status', 'woothemes'), 'new_item_name' => __('New Order status Name', 'woothemes')), 'show_ui' => false, 'show_in_nav_menus' => false, 'query_var' => true, 'rewrite' => false));
    register_post_type("shop_coupon", array('labels' => array('name' => __('Coupons', 'woothemes'), 'singular_name' => __('Coupon', 'woothemes'), 'add_new' => __('Add Coupon', 'woothemes'), 'add_new_item' => __('Add New Coupon', 'woothemes'), 'edit' => __('Edit', 'woothemes'), 'edit_item' => __('Edit Coupon', 'woothemes'), 'new_item' => __('New Coupon', 'woothemes'), 'view' => __('View Coupons', 'woothemes'), 'view_item' => __('View Coupon', 'woothemes'), 'search_items' => __('Search Coupons', 'woothemes'), 'not_found' => __('No Coupons found', 'woothemes'), 'not_found_in_trash' => __('No Coupons found in trash', 'woothemes'), 'parent' => __('Parent Coupon', 'woothemes')), 'description' => __('This is where you can add new coupons that customers can use in your store.', 'woothemes'), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'publicly_queryable' => true, 'exclude_from_search' => true, 'show_in_menu' => 'woocommerce', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_nav_menus' => false));
    if (!taxonomy_exists('product_type')) {
        register_taxonomy('product_type', array('post'));
        register_taxonomy('shop_order_status', array('post'));
    }
    $product_types = array('simple', 'grouped', 'variable', 'downloadable', 'virtual');
    foreach ($product_types as $type) {
        if (!get_term_by('slug', sanitize_title($type), 'product_type')) {
            wp_insert_term($type, 'product_type');
        }
    }
    $order_status = array('pending', 'failed', 'on-hold', 'processing', 'completed', 'refunded', 'cancelled');
    foreach ($order_status as $status) {
        if (!get_term_by('slug', sanitize_title($status), 'shop_order_status')) {
            wp_insert_term($status, 'shop_order_status');
        }
    }
}
开发者ID:eddiewilson,项目名称:new-ke,代码行数:31,代码来源:admin-import.php


示例17: __construct

 public function __construct($post_id = null)
 {
     if (!post_type_exists('hocwp_mo')) {
         $this->register_post_type();
     }
     $this->post_id = $post_id;
 }
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:7,代码来源:class-hocwp-mo.php


示例18: register_post_types

 function register_post_types()
 {
     if (post_type_exists('cupid_gallery')) {
         return;
     }
     register_post_type('cupid_gallery', array('label' => __('Cupid Gallery', 'cupid'), 'description' => __('Gallery Description', 'cupid'), 'labels' => array('name' => 'Gallery', 'singular_name' => 'Gallery', 'menu_name' => __('Gallery', 'cupid'), 'parent_item_colon' => __('Parent Item:', 'cupid'), 'all_items' => __('All Gallery', 'cupid'), 'view_item' => __('View Item', 'cupid'), 'add_new_item' => __('Add New Gallery', 'cupid'), 'add_new' => __('Add New', 'cupid'), 'edit_item' => __('Edit Item', 'cupid'), 'update_item' => __('Update Item', 'cupid'), 'search_items' => __('Search Item', 'cupid'), 'not_found' => __('Not found', 'cupid'), 'not_found_in_trash' => __('Not found in Trash', 'cupid')), 'supports' => array('title', 'excerpt', 'thumbnail'), 'public' => true, 'has_archive' => true));
 }
开发者ID:adwleg,项目名称:site,代码行数:7,代码来源:gallery.php


示例19: mesocolumn_theme_widgets_init

function mesocolumn_theme_widgets_init()
{
    global $bp_active;
    register_sidebar(array('name' => __('Tabbed Sidebar', TEMPLATE_DOMAIN), 'id' => 'tabbed-sidebar', 'description' => __('Sidebar Tabbed widget area', TEMPLATE_DOMAIN), 'before_widget' => '<div class="tabbertab"><aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside></div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
    register_sidebar(array('name' => __('Right Sidebar', TEMPLATE_DOMAIN), 'id' => 'right-sidebar', 'description' => __('Right sidebar widget area', TEMPLATE_DOMAIN), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
    if (class_exists('woocommerce')) {
        register_sidebar(array('name' => __('Shop Sidebar', TEMPLATE_DOMAIN), 'id' => 'shop-sidebar', 'description' => __('Widget area for WooCommerce Shop Pages', TEMPLATE_DOMAIN), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
    }
    if (class_exists('jigoshop')) {
        register_sidebar(array('name' => __('Shop Sidebar', TEMPLATE_DOMAIN), 'id' => 'shop-sidebar', 'description' => __('Widget area for Jigo Shop Pages', TEMPLATE_DOMAIN), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
    }
    if (post_type_exists('portfolio')) {
        register_sidebar(array('name' => __('Portfolio Sidebar', TEMPLATE_DOMAIN), 'id' => 'portfolio-sidebar', 'description' => __('Widget area for Portfolio Pages', TEMPLATE_DOMAIN), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
    }
    if (class_exists('bbPress')) {
        register_sidebar(array('name' => __('Forum Sidebar', TEMPLATE_DOMAIN), 'id' => 'forum-sidebar', 'description' => __('Widget area for BBPress Forum Pages', TEMPLATE_DOMAIN), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
    }
    if ($bp_active == 'true') {
        register_sidebar(array('name' => __('BuddyPress Sidebar', TEMPLATE_DOMAIN), 'id' => 'buddypress-sidebar', 'description' => __('Widget area for BuddyPress Pages', TEMPLATE_DOMAIN), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
    }
    register_sidebar(array('name' => __('First Footer Widget Area', TEMPLATE_DOMAIN), 'id' => 'first-footer-widget-area', 'description' => __('The first footer widget area', TEMPLATE_DOMAIN), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
    register_sidebar(array('name' => __('Second Footer Widget Area', TEMPLATE_DOMAIN), 'id' => 'second-footer-widget-area', 'description' => __('The second footer widget area', TEMPLATE_DOMAIN), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
    register_sidebar(array('name' => __('Third Footer Widget Area', TEMPLATE_DOMAIN), 'id' => 'third-footer-widget-area', 'description' => __('The third footer widget area', TEMPLATE_DOMAIN), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
    register_sidebar(array('name' => __('Fourth Footer Widget Area', TEMPLATE_DOMAIN), 'id' => 'fourth-footer-widget-area', 'description' => __('The fourth footer widget area', TEMPLATE_DOMAIN), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
}
开发者ID:jrbranaa,项目名称:pitchperspectives,代码行数:25,代码来源:widget-functions.php


示例20: init

 /**
  * Initialize by constructing metaboxes based on supported post formats
  *
  * @since 1.0
  */
 public function init()
 {
     if ($post_formats_support = get_theme_support('post-formats')) {
         /* Get supported post formats */
         if (!isset($post_formats_support[0]) || !is_array($post_formats_support[0])) {
             $post_f 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP post_type_supports函数代码示例发布时间:2022-05-15
下一篇:
PHP post_type_archive_title函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap