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

PHP is_post_type_hierarchical函数代码示例

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

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



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

示例1: wp_edit

 function wp_edit()
 {
     global $post_type, $wp_query;
     if ($post_type != GALLERY_POST_TYPE_SLUG) {
         return;
     }
     if (!current_user_can('edit_others_pages') || !post_type_supports($post_type, 'page-attributes') && !is_post_type_hierarchical($post_type)) {
         // check permission
         return;
     }
     add_action('restrict_manage_posts', array($this, 'restrict_manage_posts'));
     // posts per page drop down UI
     if (isset($_GET['per_page']) && ($_GET['per_page'] == 99999 || $_GET['per_page'] % 10 == 0)) {
         update_user_option(get_current_user_id(), 'edit_' . $post_type . '_per_page', (int) $_GET['per_page']);
     }
     add_filter('views_' . get_current_screen()->id, array($this, 'sort_by_order_link'));
     // add view by menu order to views
     add_filter('contextual_help', array($this, 'contextual_help'));
     // add contextual help to hierarchical post screens
     #if ( $wp_query->query['orderby'] == 'menu_order title' ) {	// we can only sort if we're organized by menu order; WP 3.2 and 3.1 versions
     wp_enqueue_script('simple-page-ordering', THEMEURL . 'inc/gallery-ordering/simple-page-ordering.js', array('jquery-ui-sortable'), '0.9.7', true);
     $js_trans = array('RepositionTree' => __("Items can only be repositioned within their current branch in the page tree / hierarchy (next to pages with the same parent).\n\nIf you want to move this item into a different part of the page tree, use the Quick Edit feature to change the parent before continuing.", TD));
     #wp_localize_script( 'simple-page-ordering', 'simple_page_ordering_l10n', $js_trans );
     #}
 }
开发者ID:w392807287,项目名称:FirstRepository,代码行数:25,代码来源:simple-page-ordering.php


示例2: jetpack_breadcrumbs

/**
 * Plugin Name: Site Breadcrumbs
 * Plugin URI: https://wordpress.com
 * Description: Quickly add breadcrumbs to the single view of a hierarchical post type or a hierarchical taxonomy.
 * Author: Automattic
 * Version: 1.0
 * Author URI: https://wordpress.com
 * License: GPL2 or later
 */
function jetpack_breadcrumbs()
{
    $taxonomy = is_category() ? 'category' : get_query_var('taxonomy');
    $is_taxonomy_hierarchical = is_taxonomy_hierarchical($taxonomy);
    $post_type = is_page() ? 'page' : get_query_var('post_type');
    $is_post_type_hierarchical = is_post_type_hierarchical($post_type);
    if (!($is_post_type_hierarchical || $is_taxonomy_hierarchical) || is_front_page()) {
        return;
    }
    $breadcrumb = '';
    if ($is_post_type_hierarchical) {
        $post_id = get_queried_object_id();
        $ancestors = array_reverse(get_post_ancestors($post_id));
        if ($ancestors) {
            foreach ($ancestors as $ancestor) {
                $breadcrumb .= '<span itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a href="' . esc_url(get_permalink($ancestor)) . '" itemprop="item"><span itemprop="name">' . esc_html(get_the_title($ancestor)) . '</span></a></span>';
            }
        }
        $breadcrumb .= '<span class="current-page" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><span itemprop="name">' . esc_html(get_the_title($post_id)) . '</span></span>';
    } elseif ($is_taxonomy_hierarchical) {
        $current = get_term(get_queried_object_id(), $taxonomy);
        if (is_wp_error($current)) {
            return;
        }
        if ($current->parent) {
            $breadcrumb = jetpack_get_term_parents($current->parent, $taxonomy);
        }
        $breadcrumb .= '<span class="current-category" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><span itemprop="name">' . esc_html($current->name) . '</span></span>';
    }
    $home = '<span itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a href="' . esc_url(home_url('/')) . '" class="home-link" itemprop="item" rel="home"><span itemprop="name">' . esc_html__('Home', 'jetpack') . '</span></a></span>';
    echo '<nav class="entry-breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">' . $home . $breadcrumb . '</nav>';
}
开发者ID:kanei,项目名称:vantuch.cz,代码行数:41,代码来源:site-breadcrumbs.php


示例3: acs_scripts

 function acs_scripts()
 {
     global $pagenow;
     if (isset($_GET['post_type'])) {
         $post_type = $_GET['post_type'];
         if (is_post_type_hierarchical($post_type)) {
             add_filter('admin_body_class', 'acs_admin_body_class');
         }
         function acs_admin_body_class($classes)
         {
             $classes .= ' ' . 'acs-hier';
             return $classes;
         }
     }
     if (is_admin() && isset($_GET['post_type']) && $pagenow == 'edit.php') {
         //make sure jquery is loaded
         wp_enqueue_script('jquery');
         //cookie script for saving collapse states
         wp_enqueue_script('jquery-cookie', plugins_url('js/jquery.cookie.js', __FILE__), 'jquery', '1.4.0');
         //main collapse pages script
         wp_enqueue_script('acs-js', plugins_url('js/admin_collapse_subpages.js', __FILE__), false, '2.0');
         //Load Styles
         wp_enqueue_style('acs-css', plugins_url('css/style.css', __FILE__), false, '2.0', 'screen');
         wp_localize_script('acs-js', 'acs_l10n_vars', array('lexpandall' => __('Expand All', 'admin-collapse-subpages'), 'lcollapseall' => __('Collapse All', 'admin-collapse-subpages')));
     }
 }
开发者ID:BennyHudson,项目名称:quoin,代码行数:26,代码来源:admin_collapse_subpages.php


示例4: copy

 /**
  * Create a Duplicate post
  */
 static function copy($post, $post_title = '', $post_name = '', $post_type = 'sp_report')
 {
     // We don't want to clone revisions
     if ($post->post_type == 'revision') {
         return;
     }
     if ($post->post_type != 'attachment') {
         $status = 'draft';
     }
     $new_post_author = wp_get_current_user();
     $new_post = array('menu_order' => $post->menu_order, 'comment_status' => $post->comment_status, 'ping_status' => $post->ping_status, 'post_author' => $new_post_author->ID, 'post_content' => $post->post_content, 'post_excerpt' => $post->post_excerpt, 'post_mime_type' => $post->post_mime_type, 'post_password' => $post->post_password, 'post_status' => $post->post_status, 'post_title' => empty($post_title) ? $post->post_title : $post_title, 'post_type' => empty($post_type) ? $post->post_type : $post_type);
     if ($post_name != '') {
         $new_post['post_name'] = $post_name;
     }
     /*
     $new_post['post_date'] = $new_post_date =  $post->post_date ;
     $new_post['post_date_gmt'] = get_gmt_from_date($new_post_date);
     */
     $new_post_id = wp_insert_post($new_post);
     // If you have written a plugin which uses non-WP database tables to save
     // information about a post you can hook this action to dupe that data.
     if ($post->post_type == 'page' || function_exists('is_post_type_hierarchical') && is_post_type_hierarchical($post->post_type)) {
         do_action('sp_duplicate_page', $new_post_id, $post);
     } else {
         do_action('sp_duplicate_post', $new_post_id, $post);
     }
     delete_post_meta($new_post_id, '_sp_original');
     add_post_meta($new_post_id, '_sp_original', $post->ID);
     add_post_meta($new_post_id, '_open_count', 0);
     return $new_post_id;
 }
开发者ID:radscheit,项目名称:unicorn,代码行数:34,代码来源:class-sendpress-posts.php


示例5: shortcode_handler

 public function shortcode_handler($atts, $content = null, $tag = '')
 {
     if (!is_post_type_hierarchical(get_post_type())) {
         return '';
     }
     $ancestors = get_post_ancestors(get_the_ID());
     if (!$ancestors) {
         return '';
     }
     $r = [];
     $ancestors = array_reverse($ancestors);
     foreach ($ancestors as $ancestor) {
         $classes = ['hestia-ancestor', 'hestia-wrap', sprintf('post-%s', esc_attr($ancestor))];
         $permalink = get_permalink($ancestor);
         $has_thumbnail = has_post_thumbnail($ancestor);
         if ($has_thumbnail) {
             // Because who doesn't love a properly alphabetized list?
             array_unshift($classes, 'has-post-thumbnail');
         }
         $r[] = sprintf('<div class="%s">', implode(' ', $classes));
         $r[] = sprintf('<a href="%1$s">', esc_attr($permalink));
         if ($has_thumbnail) {
             $r[] = get_the_post_thumbnail($ancestor);
         }
         $r[] = get_the_title($ancestor);
         $r[] = '</a>';
         $r[] = '</div>';
     }
     return implode("\n", $r);
 }
开发者ID:ssnepenthe,项目名称:hestia,代码行数:30,代码来源:Ancestors.php


示例6: addMenu

 function addMenu()
 {
     global $userdata;
     //put a menu for all custom_type
     $post_types = get_post_types();
     $options = get_option('cpto_options');
     //get the required user capability
     $capability = '';
     if (isset($options['capability']) && !empty($options['capability'])) {
         $capability = $options['capability'];
     } else {
         if (is_numeric($options['level'])) {
             $capability = userdata_get_user_level();
         } else {
             $capability = 'install_plugins';
         }
     }
     foreach ($post_types as $post_type_name) {
         if ($post_type_name == 'page') {
             continue;
         }
         //ignore bbpress
         if ($post_type_name == 'reply' || $post_type_name == 'topic') {
             continue;
         }
         if ($post_type_name == 'post') {
             add_submenu_page('edit.php', __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-' . $post_type_name, array(&$this, 'SortPage'));
         } else {
             if (!is_post_type_hierarchical($post_type_name)) {
                 add_submenu_page('edit.php?post_type=' . $post_type_name, __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-' . $post_type_name, array(&$this, 'SortPage'));
             }
         }
     }
 }
开发者ID:santikrass,项目名称:apache,代码行数:34,代码来源:cpto-class.php


示例7: get_original_column_value

 /**
  * @since 2.2.1
  */
 public function get_original_column_value($column, $id)
 {
     global $post;
     // Setup post data for current post
     $post_old = $post;
     $post = get_post($id);
     setup_postdata($post);
     // Remove Admin Columns action for this column's value
     remove_action("manage_{$this->post_type}_posts_custom_column", array($this, 'manage_value_callback'), 100, 2);
     ob_start();
     // Run WordPress native actions to display column content
     if (is_post_type_hierarchical($this->post_type)) {
         do_action('manage_pages_custom_column', $column, $id);
     } else {
         do_action('manage_posts_custom_column', $column, $id);
     }
     do_action("manage_{$this->post_type}_posts_custom_column", $column, $id);
     $contents = ob_get_clean();
     // Add removed Admin Columns action for this column's value
     add_action("manage_{$this->post_type}_posts_custom_column", array($this, 'manage_value_callback'), 100, 2);
     // Restore original post object
     $post = $post_old;
     if ($post) {
         setup_postdata($post);
     }
     return $contents;
 }
开发者ID:vossavant,项目名称:phoenix,代码行数:30,代码来源:post.php


示例8: shortcode_handler

 public function shortcode_handler($atts, $content = null, $tag = '')
 {
     if (!is_post_type_hierarchical(get_post_type())) {
         return '';
     }
     $args = ['order' => 'ASC', 'orderby' => 'menu_order', 'post_parent' => get_the_ID(), 'post_type' => get_post_type(), 'posts_per_page' => 20];
     $query = new WP_Query($args);
     $r = [];
     if ($query->have_posts()) {
         while ($query->have_posts()) {
             $query->the_post();
             $classes = ['hestia-child', 'hestia-wrap', sprintf('post-%s', esc_attr(get_the_ID()))];
             $has_thumbnail = has_post_thumbnail();
             $permalink = get_permalink();
             if ($has_thumbnail) {
                 // Because who doesn't love a properly alphabetized list?
                 array_unshift($classes, 'has-post-thumbnail');
             }
             $r[] = sprintf('<div class="%s">', implode(' ', $classes));
             $r[] = sprintf('<a href="%s">', esc_attr($permalink));
             if ($has_thumbnail) {
                 $r[] = get_the_post_thumbnail();
             }
             $r[] = get_the_title();
             $r[] = '</a>';
             $r[] = '</div>';
         }
     }
     wp_reset_postdata();
     return implode("\n", $r);
 }
开发者ID:ssnepenthe,项目名称:hestia,代码行数:31,代码来源:Children.php


示例9: isHierarchical

 /**
  * put your comment there...
  * 
  */
 protected function isHierarchical()
 {
     // Initialize.
     $typeParams =& $this->getTypeParams();
     // Check if post_type hierarchical.
     return is_post_type_hierarchical($typeParams['type']);
 }
开发者ID:JSreactor,项目名称:MarketCrater.com,代码行数:11,代码来源:post.php


示例10: init

 public static function init()
 {
     global $pagenow;
     if ($pagenow == 'edit.php' && !empty($_REQUEST['post_type']) && $_REQUEST['post_type'] == EM_POST_TYPE_EVENT) {
         //only needed for events list
         if (!empty($_REQUEST['category_id']) && is_numeric($_REQUEST['category_id'])) {
             $term = get_term_by('id', $_REQUEST['category_id'], EM_TAXONOMY_CATEGORY);
             if (!empty($term->slug)) {
                 $_REQUEST['category_id'] = $term->slug;
             }
         }
         //hide some cols by default:
         $screen = 'edit-' . EM_POST_TYPE_EVENT;
         $hidden = get_user_option('manage' . $screen . 'columnshidden');
         if (!$hidden) {
             $hidden = array('event-id');
             update_user_option(get_current_user_id(), "manage{$screen}columnshidden", $hidden, true);
         }
         //deal with actions
         $row_action_type = is_post_type_hierarchical(EM_POST_TYPE_EVENT) ? 'page_row_actions' : 'post_row_actions';
         add_filter($row_action_type, array('EM_Event_Posts_Admin', 'row_actions'), 10, 2);
         add_action('admin_head', array('EM_Event_Posts_Admin', 'admin_head'));
         //collumns
         add_filter('manage_edit-' . EM_POST_TYPE_EVENT . '_columns', array('EM_Event_Posts_Admin', 'columns_add'));
         add_filter('manage_' . EM_POST_TYPE_EVENT . '_posts_custom_column', array('EM_Event_Posts_Admin', 'columns_output'), 10, 2);
     }
     //clean up the views in the admin selection area - WIP
     //add_filter('views_edit-'.EM_POST_TYPE_EVENT, array('EM_Event_Posts_Admin','restrict_views'),10,2);
     //add_filter('views_edit-event-recurring', array('EM_Event_Posts_Admin','restrict_views'),10,2);
     //add filters to event post list tables
     add_action('restrict_manage_posts', array('EM_Event_Posts_Admin', 'restrict_manage_posts'));
 }
开发者ID:interfisch,项目名称:lm,代码行数:32,代码来源:em-event-posts-admin.php


示例11: add_custom_columns_hooks

 /**
  * Add custom columns hooks.
  */
 public function add_custom_columns_hooks()
 {
     if ($this->has_custom_columns()) {
         $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : 'post';
         switch ($post_type) {
             case 'post':
             case 'page':
                 add_filter('manage_' . $post_type . 's_columns', array($this->get_custom_column_instance(), 'add_posts_management_column'));
                 if ($this->get_custom_column_instance()->show_management_column_content($post_type)) {
                     add_filter('manage_' . $post_type . 's_custom_column', array($this->get_custom_column_instance(), 'add_content_for_posts_management_column'));
                 }
                 break;
             default:
                 if (in_array($post_type, array_keys($this->sitepress->get_translatable_documents()), true)) {
                     add_filter('manage_' . $post_type . '_posts_columns', array($this->get_custom_column_instance(), 'add_posts_management_column'));
                     if (is_post_type_hierarchical($post_type)) {
                         if ($this->get_custom_column_instance()->show_management_column_content($post_type)) {
                             add_action('manage_pages_custom_column', array($this->get_custom_column_instance(), 'add_content_for_posts_management_column'));
                             add_action('manage_posts_custom_column', array($this->get_custom_column_instance(), 'add_content_for_posts_management_column'));
                             // add this too - for more types plugin
                         }
                     } else {
                         if ($this->get_custom_column_instance()->show_management_column_content($post_type)) {
                             add_action('manage_posts_custom_column', array($this->get_custom_column_instance(), 'add_content_for_posts_management_column'));
                         }
                     }
                 }
         }
     }
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:33,代码来源:class-wpml-custom-columns-hooks.php


示例12: init

 function init()
 {
     global $pagenow;
     if ($pagenow == 'edit.php' && !empty($_REQUEST['post_type']) && $_REQUEST['post_type'] == EM_POST_TYPE_EVENT) {
         //only needed for events list
         if (!empty($_REQUEST['category_id']) && is_numeric($_REQUEST['category_id'])) {
             $term = get_term_by('id', $_REQUEST['category_id'], EM_TAXONOMY_CATEGORY);
             if (!empty($term->slug)) {
                 $_REQUEST['category_id'] = $term->slug;
             }
         }
         //hide some cols by default:
         $screen = 'edit-' . EM_POST_TYPE_EVENT;
         $hidden = get_user_option('manage' . $screen . 'columnshidden');
         if (!$hidden) {
             $hidden = array('event-id');
             update_user_option(get_current_user_id(), "manage{$screen}columnshidden", $hidden, true);
         }
         //deal with actions
         $row_action_type = is_post_type_hierarchical(EM_POST_TYPE_EVENT) ? 'page_row_actions' : 'post_row_actions';
         add_filter($row_action_type, array('EM_Event_Posts_Admin', 'row_actions'), 10, 2);
         add_action('admin_head', array('EM_Event_Posts_Admin', 'admin_head'));
         //collumns
         add_filter('manage_edit-' . EM_POST_TYPE_EVENT . '_columns', array('EM_Event_Posts_Admin', 'columns_add'));
         add_filter('manage_' . EM_POST_TYPE_EVENT . '_posts_custom_column', array('EM_Event_Posts_Admin', 'columns_output'), 10, 2);
         //TODO alter views of locations, events and recurrences, specifically find a good way to alter the wp_count_posts method to force user owned posts only
         //add_filter('views_edit-'.EM_POST_TYPE_EVENT, array('EM_Event_Posts_Admin','views'),10,1);
     }
     add_action('restrict_manage_posts', array('EM_Event_Posts_Admin', 'restrict_manage_posts'));
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:30,代码来源:em-event-posts-admin.php


示例13: wp_unique_post_slug

 function wp_unique_post_slug($slug_suggested, $post_id, $post_status, $post_type, $post_parent, $slug)
 {
     if ($post_status !== 'auto-draft' && $this->sitepress->is_translated_post_type($post_type)) {
         $post_language = $post_id ? $this->post_translations->get_element_lang_code($post_id) : $this->sitepress->get_current_language();
         $parent = is_post_type_hierarchical($post_type) ? (int) $post_parent : false;
         $slug_suggested_wpml = $this->find_unique_slug_post($post_id, $post_type, $post_language, $parent, $slug);
     }
     return isset($slug_suggested_wpml) ? $slug_suggested_wpml : $slug_suggested;
 }
开发者ID:aarongillett,项目名称:B22-151217,代码行数:9,代码来源:wpml-slug-filter.class.php


示例14: test_register_post_type

 function test_register_post_type()
 {
     $this->assertNull(get_post_type_object('foo'));
     register_post_type('foo');
     $pobj = get_post_type_object('foo');
     $this->assertInstanceOf('WP_Post_Type', $pobj);
     $this->assertEquals('foo', $pobj->name);
     // Test some defaults
     $this->assertFalse(is_post_type_hierarchical('foo'));
     $this->assertEquals(array(), get_object_taxonomies('foo'));
     _unregister_post_type('foo');
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:12,代码来源:types.php


示例15: content_audit_column_setup

function content_audit_column_setup()
{
    global $current_user;
    get_currentuserinfo();
    $role = is_array($current_user->roles) ? array_shift($current_user->roles) : '';
    $options = get_option('content_audit');
    if (!is_array($options['post_types'])) {
        $options['post_types'] = array($options['post_types']);
    }
    $allowed = $options['rolenames'];
    if (!is_array($allowed)) {
        $allowed = array($allowed);
    }
    if (is_multisite() && is_super_admin() || in_array($role, $allowed)) {
        foreach ($options['post_types'] as $type) {
            switch ($type) {
                case 'post':
                    add_filter('manage_posts_columns', 'content_audit_columns');
                    add_action('manage_posts_custom_column', 'content_audit_custom_column', 10, 2);
                    add_filter('manage_edit-post_sortable_columns', 'content_audit_register_sortable');
                    break;
                case 'page':
                    add_filter('manage_pages_columns', 'content_audit_columns');
                    add_action('manage_pages_custom_column', 'content_audit_custom_column', 10, 2);
                    add_filter('manage_edit-page_sortable_columns', 'content_audit_register_sortable');
                    break;
                case 'attachment':
                    add_filter('manage_media_columns', 'content_audit_columns');
                    add_action('manage_media_custom_column', 'content_audit_custom_column', 10, 2);
                    add_filter('manage_edit-media_sortable_columns', 'content_audit_register_sortable');
                    break;
                default:
                    if (post_type_exists($type) && in_array($type, $options['post_types'])) {
                        add_filter('manage_' . $type . '_posts_columns', 'content_audit_columns');
                        add_filter('manage_edit-' . $type . '_sortable_columns', 'content_audit_register_sortable');
                        if (is_post_type_hierarchical($type) == true) {
                            add_action('manage_pages_custom_column', 'content_audit_custom_column', 10, 2);
                        } else {
                            add_action('manage_posts_custom_column', 'content_audit_custom_column', 10, 2);
                        }
                    }
            }
            // add filter dropdowns
            add_action('restrict_manage_posts', 'content_audit_restrict_content_authors');
            add_action('restrict_manage_posts', 'content_audit_restrict_content_owners');
            add_action('restrict_manage_posts', 'content_audit_restrict_content_status');
            // modify edit screens' query when dropdown option is chosen
            add_filter('posts_where', 'content_audit_posts_where');
            // Add author field to quick edit
            //			add_action( 'quick_edit_custom_box', 'add_quickedit_content_owner' );
        }
    }
}
开发者ID:UMWEDU,项目名称:content-audit,代码行数:53,代码来源:content-audit-report.php


示例16: update_post

 /**
  * rebuild permalink when saving post if parent/name has changed
  * Hook for 'post_updated'
  */
 public function update_post($post_ID, $post_after, $post_before)
 {
     global $sublanguage_admin;
     // only if post is hierarchical and translatable or translation
     if (in_array($post_after->post_type, $sublanguage_admin->options['cpt']) && is_post_type_hierarchical($post_after->post_type) || $sublanguage_admin->get_language_by_type($post_after->post_type) !== false) {
         // only if parent or name have changed
         if ($post_after->post_parent != $post_before->post_parent || $post_after->post_name != $post_before->post_name || $post_after->post_status != $post_before->post_status) {
             $sublanguage_admin->disable_translate_home_url = true;
             flush_rewrite_rules();
             $sublanguage_admin->disable_translate_home_url = false;
         }
     }
 }
开发者ID:Blueprint-Marketing,项目名称:sublanguage,代码行数:17,代码来源:admin-pagenode.php


示例17: addPostVars

 /**
  * Post Items
  */
 public function addPostVars($post)
 {
     $this->post_data->id = $post->ID;
     $this->post_data->parent_id = $post->post_parent;
     $this->post_data->title = $post->post_title;
     $this->post_data->password = $post->post_password;
     $this->post_data->status = $post->post_status;
     $this->post_data->type = $post->post_type;
     $this->post_data->comment_status = $post->comment_status;
     $this->post_data->content = $post->post_content;
     $this->post_data->hierarchical = is_post_type_hierarchical($post->post_type);
     $this->post_data->link = get_the_permalink($post->ID);
 }
开发者ID:dtwist,项目名称:wp-nested-pages,代码行数:16,代码来源:PostDataFactory.php


示例18: isParentOf

 function isParentOf($query)
 {
     $this->setupBaseInfo();
     if (!is_post_type_hierarchical($this->type)) {
         return false;
     }
     if (!isset($query->post) || !isset($query->post->post_type) || $this->type != $query->post->post_type) {
         return false;
     }
     $depth = 0;
     $found = $this->findChild($this->id, $query->post->ID, $this->children, $depth);
     return $found;
 }
开发者ID:rotoballer,项目名称:emily,代码行数:13,代码来源:post_type.class.php


示例19: can_monitor_post

 public function can_monitor_post($post, $post_before, $form_data)
 {
     if ($post->post_status !== 'publish' || $post_before->post_status !== 'publish') {
         return false;
     }
     if (is_post_type_hierarchical($post->post_type)) {
         return false;
     }
     if (!isset($form_data['redirection_slug'])) {
         return false;
     }
     return true;
 }
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:13,代码来源:monitor.php


示例20: test_bbp_topic_post_type

 /**
  * @covers ::bbp_topic_post_type
  * @covers ::bbp_get_topic_post_type
  */
 public function test_bbp_topic_post_type()
 {
     $t = $this->factory->topic->create();
     $tobj = get_post_type_object('topic');
     $this->assertInstanceOf('stdClass', $tobj);
     $this->assertEquals('topic', $tobj->name);
     // Test some defaults
     $this->assertFalse(is_post_type_hierarchical('topic'));
     $topic_type = bbp_topic_post_type($t);
     $this->expectOutputString('topic', $topic_type);
     $topic_type = bbp_get_topic_post_type($t);
     $this->assertSame('topic', $topic_type);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:17,代码来源:post_type.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP is_post_type_viewable函数代码示例发布时间:2022-05-15
下一篇:
PHP is_post_type_archive函数代码示例发布时间: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