wrosner
Forum Replies Created
-
I have been looking high and low for an answer to my problem which is related to above.
In my template I am displaying a page and wanting to show groups of related posts on the right. Each group is a category and each post is also tagged with a keyword. In this particular part of my site I am using the title of the page as the match for the keyword. Example might be category of “Quick Tips” for tag equaling “Foo”. I would want that post listed when on the “Foo” page.
Here’s the code.
<?php $args ="cat=80&tag=".$mypage_title."&showposts=5"; echo ($args); $recent = new WP_Query($args); if ($recent->have_posts()) { ?><h4>Quick Tips</h4> <ul> <?php while($recent->have_posts()) : $recent->the_post(); //if (has_tag($mypage_title)) { if (get_post_meta($post->ID, 'flv', true)) { ?> <li><a class="sidebarnav1" href="<?php the_permalink()?>"><img width="20" src="/wordpress/wp-content/themes/revolution_business-10/_images/video2.jpeg"> <?php the_title(); ?></a></li> <?php }else{ ?> <li><a class="sidebarnav1" href="<?php the_permalink()?>"><?php the_title(); ?></a></li> <?php }//} endwhile; ?> </ul>
When I use add the “tag=????” I stopped getting back any posts. I have echo’d my $args and they do contain the page title. I got page title using
$mypage_title = trim(wp_title('',false,''));
What am I doing wrong that combining category and tag won’t work?
Thanks for any help!
Wes