Multiple $Get_Posts?
-
I have this plugin in WordPress that I’ve heavily modified. The purpose of the plugin is originally to display thumbnails for whatever category you tell it to. As of right now, I’ve made it done much more than that. But anyways, here is the shortcode for the plugin..
[categorythumbnaillist 7]
7 being the category ID of course. The plugin gets the posts for whatever category and orders them using this code that I made:$args=array( 'showposts'=>5, 'category'=> $listCatId[1], 'orderby'=> $categoryThumbnailList_OrderType, 'order'=> $categoryThumbnailList_Order ); $myposts = get_posts( $args);
Now, I wanted the plugin to only show posts if it has has the tag “news” in it. So I did the news tag in like so:
$args=array( 'tag' => 'news', 'showposts'=>5, 'category'=> $listCatId[1], 'orderby'=> $categoryThumbnailList_OrderType, 'order'=> $categoryThumbnailList_Order ); $myposts = get_posts( $args);
$myposts = get_posts( $args );
This sucesfully displays 5 posts if it has the “news” tag in it. But here is the problem…I’m going to be using this plugin multiple times on one page. So when I use the shortcode listed above with a different category ID, the plugin doesn’t display posts for the respective category since there are no posts tagged with “news” other than in the news category. ??
I’m going to be using the plugin with my news category, photos category and audio category. I would like it to display each categories thumbnails via shortcode (like the plugin is intended to do) but also only display the news posts with the tags “news”… for only the news category. How would I make it function properly and display only news posts with the tag “news” while still displaying the other category posts properly… all via shortcode like the plugin is supposed to do? So for example… I’d have..
[categorythumbnaillist 3] (news category) [categorythumbnaillist 5] (photos category) [categorythumbnaillist 7] (audio category)
I’d like news to only display news posts with the tag “news”, photos to display the photos category posts and audio to display the audio category posts. Again, I’ve already figured out how to do one or the other, I just don’t know how to make the code do both.
Any help would truely be appreciated!!! ??
- The topic ‘Multiple $Get_Posts?’ is closed to new replies.