1
テンプレートを作成し、表示カスタムコードの行を追加しましたが、サイドバーを取得できませんでした。あなたの関数ファイルの下部カスタム投稿タイプWordPressテンプレートWordPressテンプレートでカスタムサイドバーを追加する方法
<?php
/**
* Register our sidebars and widgetized areas.
*
*/
function movie_widgets_init() {
register_sidebar(array(
'name' => 'Movie right sidebar',
'id' => 'mome_right_1',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>',
));
}
add_action('widgets_init', 'movie_widgets_init');
?>
https://codex.wordpress.org/Widgetizing_Themes
して、サイドバーを表示するに
<?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(); ?>