WordPress.org

Forums

Customizr
No sidebar.php file (7 posts)

  1. Brent Christensen
    Member
    Posted 1 year ago #

    the plugin I work on uses some custom templates for it's custom post types, and those templates utilize get_sidebar(), which throws the following error with your theme:

    Notice: Theme without sidebar.php is deprecated since version 3.0 with no alternative available. Please include a sidebar.php template in your theme. in \wp-includes\functions.php on line 2968

    thought you might like to know.

  2. nikeo
    Member
    Theme Author

    Posted 1 year ago #

    Hi Brent, thanks for letting me know this.
    What is the plugin name please?

  3. Brent Christensen
    Member
    Posted 1 year ago #

    Thanks for getting back to me.
    I'm the lead developer for Event Espresso (www.eventespresso.com) and was just trying out a bunch of themes with an upcoming version of our core plugin that isn't publicly available yet.

    there's a hook in get_sidebar() (/wp-includes/general-template.php line 85)

    do_action( 'get_sidebar', $name );

    that would have allowed an easy fix if only your sidebar file had been named:

    sidebar-class-content.php instead of class-content-sidebar.php

    So i don't know off the top of my head what another easy solution would be.

    This doesn't really affect what I'm doing at all, I'm just trying to help you out. I like this theme btw.

  4. nikeo
    Member
    Theme Author

    Posted 1 year ago #

    Ok. Thanks for the feedback

  5. Giorgio25b
    Member
    Posted 7 months ago #

    Hi guys,
    did we figure out a solution yet?

    I'm still trying to create a custom sidebar file for my CPT ('projects'), something like sidebar-projects.php, but I can't get it to work anywhere.

    I also tried to put a standard sidebar.php in ../inc/parts but no luck.

    Any suggestion Nikeo on how to solve this?

  6. nikeo
    Member
    Theme Author

    Posted 7 months ago #

    Hi Giorgio, you might want to have a look to the Widget Logic plugin :
    https://wordpress.org/plugins/widget-logic/
    It handles the WP conditional tags (including CPT conditions) very well, right below any widgets in the WP admin > widgets.
    Like for example is_single() && (get_post_type()=='projects')

    There's also the php coding way. More advanced technique but still possible with hooks API of the theme.

    Hope this will help!

  7. Giorgio25b
    Member
    Posted 7 months ago #

    Thanks Nikeo,
    but what I really want to achieve is having a custom sidebar file.php related to my CPT.

    I have created a file called sidebar-projects.php but it does not kick in properly.
    I have also created a single-projects.php file and in this one I'm not sure how to hook my sidebar-projects.php

    I know it is confusing, but I need to have a series of custom loops in my custom sidebar that are only displaying on my CPT pages.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic