• To focus on the issue at hand, I’ll start by actually describing the issue and end with the compliments and thank-yous instead of the other way around.

    Situation
    I have a set of posts with terms from a certain taxonomy (for simplicity, let’s assume they’re categories) and a main sidebar (“Main”, shown on all of these single post pages). Some posts have a single category, some posts have multiple categories.

    Plugin settings
    The plugin is set up to show a specific sidebar for each post that has a certain category. So let’s say that for all categories there’s a different sidebar.

    These sidebars are set to Replace sidebar “Main”.

    This works fine when a post has just a single category.

    Problem
    When a post has multiple categories, all of the sidebars are shown (the widgets are all combined to form one big sidebar). I would like to show just one of these sidebars (the first one).

    Question
    Is this a bug or is it intended functionality? Is there any way to do this via the interface? And if not, is there any hooks available in your plugin to control this behaviour?

    —–

    And for your daily set of compliments: you’ve done great with this plugin, it’s an amazing addition to many projects and a huge time-saver. Thanks a lot!

    https://www.ads-software.com/plugins/content-aware-sidebars/

Viewing 1 replies (of 1 total)
  • Plugin Author Joachim Jensen

    (@intoxstudio)

    Thanks for your kind words and detailed information about your problem.

    This problem might be related: https://www.ads-software.com/support/topic/multiple-sidebars-appears

    If you have a sidebar for Category 1 and a sidebar for Category 2 (that replaces a Main Sidebar), then both sidebars will be displayed with a post iff that post has both categories.
    This is intended behaviour, because sometimes conditions for different sidebars will collide (as in this example), and these sidebars will then be merged.

    If Content Aware Sidebars should pick only one of the sidebars, which one should it be? The one that was added last, the one with higher menu order or something different? You mention it should be the “first category” that takes precedence, but which one is “the first one”?

    There is currently no filter to change this behaviour and I do see that it feels illogical in this particular case so I am open to suggestions. However, if you want to change it right now, go to content-aware-sidebars.php line 602 and change:

    if ($post->handle || isset($handled_already[$host])) {

    to

    if ($post->handle) {

Viewing 1 replies (of 1 total)
  • The topic ‘Sidebars for posts with multiple terms’ is closed to new replies.