开发者

Show all posts from category X with the same taxonomy term as current post

I already have this almost working, with a neat snippet someone helped me with. Currently though its displaying all posts regardless of category or post type with the same taxonomy term as the current post. I would like to change it so I can specify which category it should loop in the posts fr开发者_如何学编程om.

This is what the code looks like: http://pastebin.com/pM8aFPQ9

I realise this is probably pretty easy to do, but I dont know where in this code I should specify the categories or how I should write to do that. Can anyone help me with this?


I used your code to solve the same problem and I filtered the posts with info from:

http://codex.wordpress.org/Class_Reference/WP_Query

Using the info on that page, in the $args that you specify, you can add 'post_type' => array('custom_post_type_01', 'custom_post_type_02');

You could also specify which categories to include (or exclude) using this code: 'category_name' => 'category';

You can find more info on the page above and you can essentially filter your posts using lots of different parameters. Hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜