I'm trying to display tags of child pages on the parent page.
In my functions.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');
In my page template:
<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>
This displays the thumbnails and titles of the child pages, but not the tags. What could be the issue?