コンテンツ(動画)の使い分け
-
○質問の主旨
・トップページ(home.php)のとき→Youtubeの動画表示させない
・各個別記事ページ(content.php)のとき→Youtubeの動画表示させたいという具合にコンテンツの表示について、
使い分けをしたいと考えております。この場合、下記の3つのファイルのうち、
どのファイルに、どのようなコードの、
記述変更を行えば、コンテンツ表示の
使い分けができるでしょうか?
詳しい方、ご教示願います。○質問の補足
テンプレート階層的には、以下の通りです。
トップ画面(home.php)
↓
記事のひな形(single.php)
↓
記事のコンテンツ(content.php)また、各個別ページで表示させる動画は、
「投稿」→「投稿の編集」から、
直接、Youtubeのアドレスを記述するつもりです。○コード
(home.php)
<?php get_header(); ?> <!-- コンテンツ --> <div id="content"> <p class="title">RECENT POSTS</p> <?php if(have_posts()): while(have_posts()): the_post(); ?> <?php get_template_part('content'); ?> <?php endwhile; endif; ?> <?php get_template_part('pagenation'); ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
(single.php)
<?php get_header(); ?> <!-- コンテンツ --> <div id="content"> <?php if(have_posts()): while(have_posts()): the_post(); ?> <?php get_template_part('content'); ?> <p class="pagenation"> <span class="oldpage"><?php previous_post_link(); ?></span> <span class="newpage"><?php next_post_link(); ?> </span> </p> <?php endwhile; endif; ?> <?php get_template_part('pagenation'); ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
(content.php)
<div class="post"> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <p class="postcat"><?php the_category(' '); ?></p> <p class="youtubethumb"><?php echo youtube_thumb('160','100','0'); ?></p> <p class="postcontent"><?php the_content(); ?></p> <p class="postinfo"><?php echo get_the_date(); ?></p> </div>
○関連質問
ショートコードでYoutubeの動画を貼りたい
http://ja.forums.wordpress.org/topic/25213?replies=3
2件の返信を表示中 - 1 - 2件目 (全2件中)
2件の返信を表示中 - 1 - 2件目 (全2件中)
- トピック「コンテンツ(動画)の使い分け」には新たに返信することはできません。