Get Block to show only posts that are in 2 specific categories?

Posted in: Newspaper
Post count: 94

Hi There!

Great Theme, one question.

I am trying to make a Block 2 which shows a combination of two categories I have made. The first category is named “Tablets” (ID 25). The second category is called “Reviews” (ID 94).

I have some posts that are in both categories, my tablet reviews.

When editing Block 2, there is an option called multiple categories filter. How do I show items that are BOTH in the category tablets and reviews? So how do I show my tablet reviews? (ID 25 + 94).

I don’t want Block 2 to show ID’s 25 and 94 together in sequential order, but only the posts that are in BOTH categories.

Hope you can help or give advise.

Post count: 854

hi,
you need to change the code of the theme for this.

in the td_data_source.php ( http://screencast.com/t/fbocELsI ) the theme calls the worpress WP_Query object. you need to send to this object the fact that you want to extract post that are in 2 categories.

here is the documentation for WP_Query : http://codex.wordpress.org/Class_Reference/WP_Query

if you are not a developer, you can hire one for this task.

Thanks for you message.
Radu A.

Post count: 94

Thanks for the info.

You sue there is no easier way? Kind of disappointed that this isn’t a standard feature of this theme.

Maybe there is a plugin that creates a new category from two others?

Post count: 94

Or what about adding a new SORT ORDER for all blocks in a next version of the theme. A sort order for ultimate customization of posts to show.

Like a sort order for showing all reviews, regardless of the rating they get. That would solve my problem immediately 🙂

So please think about adding a new sort order for all Blocks with extensive filtering options. Like only showing posts that belong to specific tags,categories etc.

Think about it…

Post count: 854

hi,
thank you for your suggestion, we will talk about this.

Thanks for you message.
Radu A.

Post count: 94

Hi,

Just to inform you. To get this simple AND-operator functionality for showing posts that are in two categories in the Widget Blocks on my website, I had to buy a premium plugin called Super Post.

Please put this feature in a next version of the theme. I find it ridiculous that this isn’t already in there.

Thank you.

Post count: 854

hi,

thank you for your suggestion.

Thanks for you message.
Radu A.

Post count: 4

I am voting with OuweAap, I want to show posts that are in both categories, for example the “May Issue” of the newspaper (which is a category), and the “life” category.

It took me an hour to work out that the filter is an OR not an AND combinator.

Suggest you add this to your documentation, maybe here:
https://forum.tagdiv.com/modules-and-blocks/

START
Category filters
To show items from more than one category add them here. (This is an OR filter).
No AND filter is available to show items that appear in more than one category.

Cheers
Miriam

Post count: 4

Looks like you can use the existing setup to choose a category AND a tag.
If my category is “May issue” and my tag is “people” then only those items that exist in the May issue category with a tag of people will show.
Effectively an AND filter.

Post count: 94

Hi MiriamNZ,

Always good to have a supporter 🙂

Also took me (more than) an hour to find out it is by default inpossible with the current version of the theme to display posts using the AND operator 🙁

Instead of suggesting to mention this in the documentation, I suggest the developers simply put this relatively simple feature in the next new version of the theme!

I am really quite surprised that nobody noticed the lack of this feature before and the developers haven’t put it in there. Now is the time! People are starting to ask for it.

Your great suggestion Miriam of using category AND tag only works if you have tagged your posts accordingly. Unfortunately I have not, so can’t use your elegant method. Maybe I will retag, will think about it.

Radu from TagDiv: can you update me on the chance of this AND feature will be implemented in the next version?

Thanks all!

  • This reply was modified 12 years by OuweAap.
Post count: 61

Hello, I have been looking for this issue in the forum and finally, I have found this topic. My problem is the same, I need to use a category filter for two different categories with AND option, not OR operator.

This topic was created 5 years ago, have developers team do something to solve it?

Thanks.

Post count: 18283

Hello !

Unfortunately at the moment there is no option to do this function.

Thank you for your understanding !

Viewing 12 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic.