説明
現在の記事が商品であるかを判別します。
使い方
<?php if ( usces_is_item( $post_id ) ) : ?>
//処理
<?php endif; ?>
パラメータ
- $post_id
- (数値)現在の記事のID。ループ内(global $post が有効)であれば $post_id を省略可。
戻り値
- (boolean)
- 商品であれば true、なければ false。
用例
アーカイブページで、商品ではない時のみ日付を表示する。
テンプレート内での記述例
<?php while ( have_posts() ) : the_post(); ?>
<div <?php post_class(); ?>>
<h2 id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" ><?php the_title(); ?></a>
</h2>
<div class="entry clearfix">
<?php if( !usces_is_item() ): ?>
<p><small><?php the_date( 'Y/n/j' ); ?></small></p>
<?php endif; ?>
<?php the_content(); ?>
</div>
</div>
<?php endwhile; ?>
フック
- 利用できるフックはありません。
変更履歴
0.7 にて導入されました。
ソースファイル
usc-e-shop/functions/template_func.php
PAGE TOP