the_tags() in a Page Template
-
I made a page template. Inside the page template is a custom query to grab a random post. I make a page, I used that page template and everything is great apart from the_tags() template tag breaking. I imagine this is because it’s a page, which doesn’t use tags and not a “post” page.
This is the custom loop code:
<?php
$rand_id = $wpdb->get_var(“SELECT ID FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_type = ‘post’ ORDER BY RAND() LIMIT 1”);
$my_query = new WP_Query(“p=$rand_id”);
?>The single random post grabbing is working fine, it’s just the the_tags() I need to work. Maybe there’s another way to query that’ll let me use the_tags().
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘the_tags() in a Page Template’ is closed to new replies.