我試圖給當前頁面添加一個用戶在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 –