Exclude category from related articles

Posted in: Newspaper
Post count: 209

Hello,

how can I remove a certain category from the related articles in a cloud based template?

I found this older post, where Bogdan B. shows a way to do this for the standard template of an older version of Newspaper by editing td_module_single_base.php.

https://forum.tagdiv.com/topic/remove-category-from-related-articles-filter/

Which file do I have to edit for cloud based templates with Newspaper X?

Post count: 35449

Hi,

For the cloud you’ll need to make the change that Bogdan show in this file wp-content/plugins/td-cloud-library/includes/tdb_config.php -> http://prntscr.com/q37yee

Thank you!

Post count: 209

Hello Calin,
could you describe or show this a little bit more exactly?
I added a comma and the following line, where 3291 is the category I want to exclude, but this seems not to work

,
'category_id' => '-3291'

  • This reply was modified 6 years by be2name.
Post count: 35449

Hi,

Yes, the “,” need to be add at the end of this line -> http://prntscr.com/q3dsec after that add the category_id.

Hope this will work.
Thank you!

Post count: 209

Hello Calin,
yes, this is what i did -> https://prnt.sc/q3e9ol but posts from that category still appear as related articles, although I also cleared the cache.
Any idea?

Post count: 35449

Hi,

Ill ‘make some investigations and I’ll let you know what is wrong with this settings and what need to be done to remove the category.

Thank you!

Post count: 209

Hello Calin,
it’s nearly a week now and I hope, the answer has not been forgotten. Please tell me where to put the code to exclude the category. Thank you!

Post count: 35449

Hi,

Please try to make the changes in wp-content/plugins/td-composer/legacy/common/wp_booster/td_data_source.php and add like this
$wp_query_args['category__not_in'] = array('3291');
https://i.imgur.com/ou31lQR.png

Hope this will help you!
Thank you!

Post count: 209

Hello Calin,
thank you! Works great!
I put this line in all three case sections, to make sure, the category does not appear no matter if I filter the related articles by tag, author or category.

Post count: 35449

Hi,

I’m glad that I was able to help you!

Have a nice day!

Viewing 10 posts - 1 through 10 (of 10 total)
The forum ‘Newspaper’ is closed to new topics and replies.