Support Forums for LiveMesh Themes & Plugins › Forums › Invent Theme Support › Output only the latest post from each child category
- This topic has 6 replies, 2 voices, and was last updated 7 years, 7 months ago by palmtree.
-
AuthorPosts
-
April 15, 2017 at 6:40 pm #26401palmtreeParticipant
Hello Code Master,
I’ve been searching on google how to do this for more than 6 hours today but I couldn’t find the solution. I am devastating.. I want to output only one latest post each from each children’s category under their parents (cat=3). So far, apart from getting more than 1 post from each child category, it is successful. My code is below.
At the moment,
<?php $args = array('numberposts' => 1) ?>
As you can easily guess..this code doesn’t seem to do anything but I hope you know what I am trying to do here. I want to limit each child category’s post to be just one (the latest post) by putting numberposts (=> 1).
My question could be little too far from the level of support you offer to the theme users however it would be great if you could take a look at this.
Thank you.
PalmtreeApril 17, 2017 at 1:58 pm #26403RaghavendraModeratorI was not sure how that would really work but online we have many solutions like these below –
https://code.tutsplus.com/tutorials/display-the-most-recent-post-in-each-category–cms-22677
http://stackoverflow.com/questions/3264323/how-do-i-get-only-1-post-from-each-category-in-wordpress
April 19, 2017 at 2:55 pm #26435RaghavendraModeratorReply by the thread owner palmtree after we migrated to the new server – meteorite.
Thank you very much for the link. I have followed the explanation in those pages and created the code http://pasted.co/090113c2
But this code output only one post under the cat id=54.
There are multiple child categories under id=54. And what I want to do is to output one (latest) post from each category.For example, if there are 7 categories under the cat id=54, the number of output post should be 7. I hope you can get what I have been trying to do…
April 19, 2017 at 2:59 pm #26436palmtreeParticipantThank you very much for the link. I have followed the explanation in those pages and created the code http://pasted.co/090113c2
But this code output only one post under the cat id=54.
There are multiple child categories under id=54. And what I want to do is to output one (latest) post from each category.For example, if there are 7 categories under the cat id=54, the number of output post should be 7. I hope you can get what I have been trying to do…
April 25, 2017 at 4:43 pm #26487palmtreeParticipantI have posted this question to stackoverflow http://stackoverflow.com/questions/43611578/output-latest-posts-from-each-child-categories-of-particular-parent-category. So far no luck.
But you are more than welcome to give me some advise. If you could do, it would be awesome!April 26, 2017 at 3:02 pm #26503RaghavendraModeratorSorry to hear you are still having trouble with this. Have been extremely busy moving to a new domain, new server etc. Will find some time and see if I can address this. Also, pls post to https://wordpress.org/support/forum/wp-advanced/ as well meanwhile and see if there is any luck.
April 26, 2017 at 3:39 pm #26504palmtreeParticipantThanks Mateorite,
I understand you are busy but thanks for your support and introducing me to the wordpress support site.
I have posted the same topic as I did on stackoverflow.
https://wordpress.org/support/topic/output-latest-posts-from-each-child-categories-of-particular-parent-category/ -
AuthorPosts
- The forum ‘Invent Theme Support’ is closed to new topics and replies.