refer to: http://cmspioneer.com/designwall/question/how-to-fetch-15-must-read-articles-from-a-category/
I have the same question, I only need to fetch “15 Must Read Articles” from a category, I have created a category called “mustread”, can you tell me how to changing functions.php to achieve the object?
Thank you!
To solve this issue, please open the functions.php file /go to line 799 -> 804.
Replace the following codes:
$post_array = array(
'posts_per_page' => $max_number_posts,
'order' => 'DESC',
'post_status' => 'publish',
'ignore_sticky_posts' => 1
);
With new codes:
$post_array = array(
'posts_per_page' => $max_number_posts,
'order' => 'DESC',
'post_status' => 'publish',
'ignore_sticky_posts' => 1
);
$post_array['category__in'] = array( /*categories ids ex: 1, 2, 3*/);
See the Screenshot below:
Please change your categories ID here: /*categories ids ex: 1, 2, 3*/
If you want to know Id of the categories, you can hover on the categories.
See the screenshot:
thank you for your reply! if the category id of “mustread” is 23, then the right code is:
$post_array = array(
'posts_per_page' => $max_number_posts,
'order' => 'DESC',
'post_status' => 'publish',
'ignore_sticky_posts' => 1
);
$post_array['category__in'] = array(category id: 23);
is that right?
Please add the following code:
$post_array['category__in'] = array(23);
thank you very much!
Actually, question..how do we remove the date from also showing in that area? I don’t want a date stamp in the dropdown of the 15 Must Read articles, how do I remove that?
Thanks for sharing this, I was also wondering how to achieve this very thing!
@Shae101s !
To resolve your issue, you can add the following code to the “Header Script”
<style>
.desktop .top-news .entry-meta {
display:none;
}
</style
Please login or Register to submit your answer