我试图给当前页面添加一个用户在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;?>
回顾: - http://stackoverflow.com/a/34897335/2667307 –