Support » Plugin: Network Posts Extended » must_include_categories usage

  • Resolved fortunerice

    (@fortunerice)


    Let me start off by saying that this is an excellent plugin and I haven’t been able to find any contending alternatives (yet!)

    The shortcodes in particular allow you to extract very specific sets of posts. However from the documentation I’m a little confused about the usage of the must_include_categories shortcode. In one part of the docs it says that must_include_categories should be a ‘true/false’ flag to indicate the AND logic, whereas in another part of the docs it says that the shortcode should directly list out the categories (rather than reference the taxonomy shortcode).

    Would appreciate some clarification on show this shortcode should be used. What I’m basically trying to achieve is to pull only posts that belong to BOTH catA and catB, but so far I’m only able to pull posts that belong to either catA OR catB.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author johnzenausa

    (@johnzenausa)

    Sorry for the confusion but the correct way is similar as follows:

    taxonomy='activities,wonder-news' and must_include_categories='true'

    means all post shown must be in both categories. If they are only in one or the other they will not be shown.

    Thread Starter fortunerice

    (@fortunerice)

    Hi thanks for the quick response. I have tried listing out both categories using the taxonomy param, and then setting must_include_categories=’true’, but what I’m getting is OR logic output rather than AND logic output. So I’m getting posts that just belong to 1 of the 2 categories. Using plugin version 7.1.9. Any ideas?

    Plugin Author johnzenausa

    (@johnzenausa)

    I’ll check it out on my site to see if it is working properly.

    Thread Starter fortunerice

    (@fortunerice)

    Eagerly awaiting your update! Thanks so much.

    Plugin Author johnzenausa

    (@johnzenausa)

    @fortunerice

    I made the following video to explain how it works. It is working on my site.

    Thread Starter fortunerice

    (@fortunerice)

    Hey John, really appreciate the time you took to make the video. It does reaffirm how it works.

    I found out why it didn’t work for me. Let me explain my set-up in a way analogous to your demo:
    I had TestPostA belonging to both categories CatA and CatB.
    I had TestPostB belonging to just category CatB.

    When I ran the shortcode [taxonomy=’CatA, CatB’ must_include_categories=’true’] I still got both TestPostA and TestPostB being pulled, contrary to the expected behaviour of just getting TestPostA.

    And now here’s what I found: For TestPostB, not only did it belong to a category named “CatB”, but it also had a tag with the identical name, i.e. a TAG called “CatB”.

    So to revise the original understanding:
    I had TestPostA belonging to both categories CatA and CatB.
    I had TestPostB belonging to just category ‘CatB’ BUT also having a TAG ‘CatB’

    And this somehow caused the plugin to include TestPostB in the results, despite TestPostB not associated to neither a category nor a tag named ‘CatA’.

    To reproduce this in your demo, I suspect that if you add a “Novels” TAG to your Test Post B, it would show up in the results despite the must_include_categories=”true” flag that’s supposed to exclude it.

    To avoid the problem now, I’ve simply removed all tags that had identical names to categories, since they were redundant info in my case anyways.

    I would be interested to know if this is reproducible on your side, but for now I don’t have any further issues.

    Plugin Author johnzenausa

    (@johnzenausa)

    I added a tag called history to the post with a category named history and ended up with the same results as you. As for now to fix it (until I get around to updating the plugin) add the argument taxonomy_type='category' and that alleviates the problem.

    I have tested the above on my website and it works as should.

    Plugin Author johnzenausa

    (@johnzenausa)

    Since it defaults to category when using must_include_categories if you want to do the same thing using tags you must also add taxonomy_type=’tag’.

    As of now it only works with categories or tags you can’t combine them. Works with custom post types also.

    Plugin Author johnzenausa

    (@johnzenausa)

    For the near future as of now to avoid wrong posts you must use taxonomy_type with only one value. That is taxonomy_type='category' or taxonomy_type='tag' but not taxonomy_type='category,tag' when must_include_categories='true' is set.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘must_include_categories usage’ is closed to new replies.