首先从保存的元键my tag slug中获取变量中的标记slug
$tag_slug = (isset(get_post_meta(get_the_ID(), \'my-tag-slug\', true))) ? get_post_meta(get_the_ID(), \'my-tag-slug\', true) : null;
现在按$tag\\u slug查询帖子,将showposts替换为posts\\u per\\u page
$args = array(
\'tag\' => $tag_slug,
\'posts_per_page\' => 5,
\'caller_get_posts\' => 1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo \'5 recent Posts with tag1\';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
endwhile;
} //if ($my_query)
wp_reset_query();