Alkorr
Member
Posted 10 months ago #
Hi. I try to modify the function alchymyth was kind enough to help me (a lot) with but I don't seem to make it work.
Here it is:
<?php global $do_not_duplicate; ?>
<?php $my_query = new WP_Query(array('posts_per_page' => 10, 'post__not_in' => get_option( 'sticky_posts' )) );
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
It is not the entire function (not needed), my problem being I try to find a way to only show posts from a specific tag. Then I want another query (using the same code) to exclude posts from this specific tag (to avoid duplicates).
I know how to do that using the old code (<?php query_posts('posts_per_page=10&tag=books'); ?>) but not this new one with arrays...
Thanks for your help! :)
Alkorr
Member
Posted 10 months ago #
I checked the http://codex.wordpress.org/Function_Reference/query_posts but there is no info on how to get posts from a specific tag.
Still searching...
Alkorr
Member
Posted 10 months ago #
I've found this thread:
http://wordpress.org/support/topic/display-posts-for-a-specific-tags-on-a-page
I used 'tag_slug__and' => array('books') in my query and only the 10 latest posts from the tag 'books' are showing now. That's great but I don't know if it is the right way to do that.
Now I'm still looking how to exclude a specific tag from the query...
Alkorr
Member
Posted 10 months ago #
Geez, I'm stuck... Anyone? Any idea? :)
Alkorr
Member
Posted 9 months ago #
May I dare asking again for help? &_&
Alkorr
Member
Posted 9 months ago #
Alkorr
Member
Posted 9 months ago #
Ok, I've talked to someone who told me it was not possible to exclude posts with a specific tag from the query. I would like to know if it is true... Thanks!