0
我有2個帖子類型,1個是遊戲,另一個是我試圖包含在這個循環中的電影,我得到了幫助,因此我不知道要更改哪些內容:在此Wordpress循環中包含自定義帖子類型
<?php if (have_posts()) : ?>
<?php /* Start the Loop */ ?>
<?php
$query = new WP_Query(array('tag__not_in' => array(20)));/* Exclude Tag 20 (reviews)*/
while($query->have_posts()):
$query->the_post();
get_template_part('content', get_post_format());
endwhile;
?>
<?php else : ?>
<?php get_template_part('no-results', 'index'); ?>
<?php endif; ?>
我會在哪裏包含這些帖子類型?
編輯:我更新了循環,但頁面只是空白/白色。繼承人我有什麼:
<?php if (have_posts()) : ?>
<?php /* Start the Loop */ ?>
<?php
$query = new WP_Query(array('post_type' => array('movies_cp','gaming_cp'), 'tag__not_in' => array(20)))
while($query->have_posts()):
$query->the_post();
get_template_part('content', get_post_format());
endwhile;
?>
<?php else : ?>
<?php get_template_part('no-results', 'index'); ?>
<?php endif; ?>
電影自定義文章類型(使用自定義文章類型UI插件):
register_post_type('movies_cp', array( 'label' => 'Movie Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'movies'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (
'name' => 'Movie Posts',
'singular_name' => 'Movie Post',
'menu_name' => 'Movie Posts',
'add_new' => 'Add Movie Post',
'add_new_item' => 'Add New Movie Post',
'edit' => 'Edit',
'edit_item' => 'Edit Movie Post',
'new_item' => 'New Movie Post',
'view' => 'View Movie Post',
'view_item' => 'View Movie Post',
'search_items' => 'Search Movie Posts',
'not_found' => 'No Movie Posts Found',
'not_found_in_trash' => 'No Movie Posts Found in Trash',
'parent' => 'Parent Movie Post',
),));
我加了變化,但我剛買了一臺白色/空白頁。我重新添加了我的循環+正在使用的自定義帖子類型 –