我想根据帖子类型在每篇帖子的顶部(单页)显示特定内容。
如果是normal
, 展示一些东西,如果是gallery
, 显示另一个。
目前代码如下:
<?php
if (has_post_format( \'post-format-normal\' , $post_id )) {
<div class="post-image-section section" style="background-image: url(<?php echo $single_post_image_url ?>);">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
<?php the_post_thumbnail(\'single-post-image\'); ?>
<?php if ( !empty(get_post(get_post_thumbnail_id())->post_excerpt) ) : ?>
<div class="flex-caption-container">
<p class="flex-caption"><?php echo get_post(get_post_thumbnail_id())->post_excerpt; ?></p>
</div>
<?php endif; ?>
</a>
</div>
} elseif ( has_post_format( \'post-format-gallery\' , $post_id )) {
<?php flexslider(\'index-post-image\'); ?>
}
?>
但它不起作用,看起来代码上有一个键入错误。。。如果帖子类型是gallery
, 显示flexslidernormal
, 显示post\\u缩略图。。。如何做到这一点?