• Resolved btmpl

    (@btmpl)


    Hi there

    I’m using Custom Sidebars on a custom post_type and everything works fine. The problem is that when I also modify the query (to limit posts with given meta_query etc.) and it returns no posts, the plugin will fallback to the default sidebar, because get_post_type() returns null

    Please add a filter / action to allow for forcing the sidebar to show up even in those cases by beeing able to override

    $post_type = get_post_type();

    in inc/class-custom-sidebars-replacer:317

    If you wish I can get a PR going for this if you agree with the idea.

    https://wordpress.org/plugins/custom-sidebars/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey there btmpl,

    How are you doing today?

    Thanks for the suggestion, I’ll definitely pass this one to our developer so he can take a look and possibly include this in one of the following versions of the plugin.

    Have a great day!

    Cheers,
    Bojan

    Hey again,

    Just a quick update for this one. You can update the line with the following as we are going to add it in the next release:

    $post_type = apply_filters( 'cs_replace_post_type', get_post_type() );

    Hope this helps 🙂

    Cheers,
    Bojan

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Keep sidebar when search results no posts.’ is closed to new replies.