Tag: それ以外


条件分岐指定タグ

2013年05月07日 wordpressテンプレートタグ

topページとそれ以外のページを分ける

例えば、topページ(index.php)には1を表示させて、

それ以外のページには2を表示といった場合など。

<?php if(is_home()): ?>
-----------------topページにのみ表示させる-----------------
<?php else: ?>
-----------------topページ以外に2表示させる-----------------
<?php endif; ?>

 

その他

<?php if(is_single()): ?> ~ <?php endif; ?>

<?php if(is_page()): ?> ~ <?php endif; ?>

<?php if(is_category()): ?> ~ <?php endif; ?>

<?php if(is_archive()): ?> ~ <?php endif; ?>

<?php if(is_tag()): ?> ~ <?php endif; ?>

<?php if(is_search()): ?> ~ <?php endif; ?>