njainb
asked 7 years ago

Fetching the “15 Must Read Articles” from a specific category and Category Widget Changes

Not able to find this piece of code to be changed for below 2 things. Pls help.

1. Fetching the “15 Must Read Articles” from a specific category or custom post type

2. Category Widget – 3 Column listing- fetching posts from custom post type

Thanks

Nitin

3 Answers
DominicStaff
answered 7 years ago

1. Currently, my theme does not yet support this problem,I sent and notified our technical team about problem. We are checking and fixing. We will inform you as soon as possible.

2.
Thanks a lot for posting this issue!
Unfortunately, I’m afraid it would not be possible to support you for this customization. Our theme does not support your request yet at the moment.

 

njainb
replied 7 years ago

Hi Dominic

njainb
replied 7 years ago

1 Can be solved by changing “function dw_top15” in functions.php of child theme. Looking for a solution of 2nd. Will buzz you if not able to solve this.

Dominic Staff
replied 7 years ago

Thanks a lot for posting this issue!
Unfortunately, I’m afraid it would not be possible to support you for this customization. Our theme does not support your request yet at the moment.

Zhenyu QI
answered 7 years ago

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!

DominicStaff
answered 7 years ago

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:

Powered by DW Question & Answer Pro