WordPress.org

Ready to get started?Download WordPress

Forums

Oxygen
How to add a sidebar to Oxygen Theme (4 posts)

  1. ajcke
    Member
    Posted 1 year ago #

    I would like to add a sidebar to this theme. I'm familiar with basic code like <?php get_sidebar('homepage'); ?> but this theme doesn't use this. It pulls the sidebars into the pages another method that I am unfamiliar with. I think it is doing this through this code <?php do_atomic( 'after_content' );

    I've created a child theme, and declared the sidebars in the child theme's functions.php. The sidebars show up in the Widgets area in the Dashboard. I created a custom page that I want the sidebar to display on.

  2. Mark
    Member
    Posted 1 year ago #

    Nope, it does it mostly the normal way, but the template files where it does it are a bit unexpected. For instance, page-template-front.php has a get_sidebar( 'primary' ) call. The secondary sidebar isn't called from the same template but from footer.php.

    Something that may throw you off when trying to disable sidebars is the fact that the full-width page template is made to be without sidebars not by excluding the sidebar template calls (as many themes do) but by disabling them for that specific template via functions.php.

    The do_atomic() calls are hooks that you could adress via functions.php to add or filter content. They don't do the sidebars.

  3. ajcke
    Member
    Posted 1 year ago #

    Ahhhh...I would have never looked in the footer.php file. So I will also need to create a second footer page.

    Thanks!

  4. Mark
    Member
    Posted 1 year ago #

    The neater way would probably be to create a custom sidebar-secondary.php (or sidebar-tertiary.php) and to call that only when you need it (removing the generic call from footer.php and avoiding the weird method of disabling it for certain templates via functions.php). That's what I'm doing anyway.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic