1
我創建了一個模板並添加了顯示自定義帖子類型的代碼行,但無法獲得側邊欄。自定義帖子類型WordPress模板如何在WordPress模板中添加自定義側欄
下面是一些我添加到我的page-movie-reviews.php
文件中的代碼:
<?php
/*<?php Template Name: Movie Reviews */ ?>
<?php get_header();?>
<?php
$query = new WP_Query(array('post_type' => 'movie-reviews', 'posts_per_page' => 5));
while ($query->have_posts()) : $query->the_post(); ?>
<div class="cusomt-title">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
</div>
<?php the_post_thumbnail(array(100, 100)); // Other resolutions (height, width) ?>
<?php the_content(); ?>
<?php the_excerpt(); ?>
<?php echo apply_filters('the_content',$mypost->post_content); ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>