• Hello,

    I’m currently facing an issue with the development of my plugin:
    I’ve coded a small blurb that allows me to add some external content on pages and posts, at the end of the page content(kind of a light Q2W3 Inc Manager plugin let’s say).
    So far it works pretty good, but I got an issue dealing with empty category pages. Since there’s no content, my extra part is not displayed.
    Is there a way – without modifying the template – to display content on an empty category page?

    Any hints appreciated!

    Thanks,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    The problem is you cannot know how themes will handle this situation. The default themes call get_search_form(), you could use that corresponding filter, but there’s no reason other themes would always make this call.

    Much more reliable is the ‘wp_footer’ action, but this typically fired after all the footer output, so is probably too late for your purposes.

    You could try ‘get_sidebar’ action. Not all themes will use it, and it fires outside the main content div, but typically before any actual sidebar content. Content output here should end up at the bottom of the page for many themes.

    As a plugin, you really just don’t have any reasonable choices in this situation.

    Thread Starter kis_marac

    (@kis_marac)

    Hi bcworkz, thanks for all the information!
    Ok, it seems that I won’t have a choice. I’ve managed to do what I wanted by modifying the content-none template file. Not the perfect solution, but it works 🙂
    Thanks,

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding content in empty category pages’ is closed to new replies.