我正在尝试在父页面上显示子页面的标记。
在我的功能中。php:
// add tag support to pages
function tags_support_all() {
register_taxonomy_for_object_type(\'post_tag\', \'page\');
}
// ensure all tags are included in queries
function tags_support_query($wp_query) {
if ($wp_query->get(\'tag\')) $wp_query->set(\'post_type\', \'any\');
}
// tag hooks
add_action(\'init\', \'tags_support_all\');
add_action(\'pre_get_posts\', \'tags_support_query\');
在我的页面模板中:<div id="masonry-loop" class = "group">
<?php
$pages = get_pages(\'child_of=\'.$post->ID.\'&sort_column=menu_order\');
$count = 0;
foreach($pages as $page)
{
$content = $page->post_content;
$images = get_field(\'gallery\', $page->ID);
$thumbnail = $images[0];
?>
<div class="artist_thumb">
<div class="artist_thumb_img"><a href="<?php echo get_page_link($page->ID) ?>" target="_blank"><img src="<?php echo $thumbnail[\'url\'] ?>"/></a></div>
<h3><a href="<?php echo get_page_link($page->ID) ?> "target="_blank"><?php echo $page->post_title ?></a></h3>
<p><?php echo $page->post_tag ?></p>
</div>
<?php
}
?>
</div>
这将显示子页面的缩略图和标题,但不显示标记。可能是什么问题?