【问题标题】:WordPress Custom Post Type Navigation + ChildrenWordPress自定义帖子类型导航+儿童
【发布时间】:2011-10-01 00:07:47
【问题描述】:

更新日期:2010 年 5 月 8 日

WordPress 现在添加了一项附加技术,如果帖子类型设置为分层,则可以显示自定义帖子类型中的项目。

不过,我想做的是使帖子项目在导航中选择时具有 .current_page_item 类。

有谁知道实现这个功能的功能吗?

    <?php 
    $args = array(
      'post_type'=>'testimonials',
      'title_li'=> __('Testimonials')
    );
    wp_list_pages( $args ); 
    ?> 

谢谢, 乔治

【问题讨论】:

  • 愿意支付 100 美元来修复此问题,Paypal 会将其提供给第一个提供有效解决方案的人!

标签: wordpress wordpress-theming custom-post-type


【解决方案1】:

使用“自定义帖子类型 ui”插件,设置 Hierarchical = true。

    register_post_type('Portfolios', array( 'label' => 'Portfolios','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post',**'hierarchical' => true**,'rewrite' => array('slug' => ''),'query_var' => true,'supports' => array('title','editor','custom-fields','revisions','thumbnail','page-attributes',),'labels' => array (
      'name' => 'Portfolios',
      'singular_name' => '',
      'menu_name' => 'Portfolios',
      'add_new' => 'Add Portfolios',
      'add_new_item' => 'Add New Portfolios',
      'edit' => 'Edit',
      'edit_item' => 'Edit Portfolios',
      'new_item' => 'New Portfolios',
      'view' => 'View Portfolios',
      'view_item' => 'View Portfolios',
      'search_items' => 'Search Portfolios',
      'not_found' => 'No Portfolios Found',
      'not_found_in_trash' => 'No Portfolios Found in Trash',
      'parent' => 'Parent Portfolios',
    ),) );

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多