【发布时间】:2016-01-20 10:12:06
【问题描述】:
我正在尝试向用户在 Wordpress 中所在的当前页面添加一个类..
到目前为止,我有下面的代码,但它不工作有人知道为什么吗?
<?php while ( have_posts() ) : the_post(); ?>
<a href="<?php echo get_the_permalink(); ?>" title="<?php echo the_title(); ?>">
<div id="grid-icon" class="icon-news<?php if (is_page($post->ID)) {
echo "page-active "; } else {} ?> col-xs-12 col-md-4">
<p><?php echo get_post_meta($post->ID, 'wpcf-short-title', true); ?></p>
</div> </a>
<?php endwhile;?>
【问题讨论】: