0

I'm working with a WordPress 4.0 install, using Omega (the ThemeHall version; there are multiple Omega themes out there).

Most of the instructions I've seen to control whether the sidebar appears or not tell me to work with the get_sidebar tag.

This theme lets me turn the sidebar on everywhere or nowhere, so I've opted to turn it on universally so I can find, and remove, get_sidebar from page templates.

But when I look at all the .php files in the main theme folder, get_sidebar doesn't appear. Anywhere. Not in page.php, index.php, footer.php, etc. etc. etc.

This is where my WordPress-understanding-powers come to a screeching halt. If get_sidebar isn't in the page templates, where is it?

This is a typical page structure in the theme; this is page.php:

<?php
/**
 * The template for displaying all pages.
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site will use a
 * different template.
 *
 * @package Omega
 */

get_header(); ?>

    <main  class="<?php echo omega_apply_atomic( 'main_class', 'content' );?>" <?php omega_attr( 'content' ); ?>>

        <?php 
        do_action( 'omega_before_content' ); 

        do_action( 'omega_content' ); 

        do_action( 'omega_after_content' ); 
        ?>

    </main><!-- .content -->

<?php get_footer(); ?>

In the absence of get_sidebar (and with sidebars turned on everywhere, I thought get_sidebar would appear somewhere in these templates), what's the best way of controlling which templates get sidebars and which don't?

  • 2
    Do you have an understanding of hooks/actions? What have Omega support said? Can you link to it? Omega is a pretty common word – Tom J Nowell Sep 11 '14 at 23:33
  • Hooks and actions? I think we may have found my problem. No idea. Forums for Omega are at themehall.com/forums. – JeanSibelius Sep 11 '14 at 23:40
  • 2
    You will need an understanding of how actions and hooks work to understand how this theme functions. – Tom J Nowell Sep 11 '14 at 23:41
  • I'd best get to reading... – JeanSibelius Sep 11 '14 at 23:43
1

In the ThemeHall Omega theme, the call to get_sidebar is wrapped in a function called omega_primary_sidebar. This can be found in hooks.php lines 180 to 185. This function then gets hooked to the omega_after_main action hook on line 35 and 36 in the same file

  • Thanks -- I'm able to manage to remove the sidebar from some areas with this information. It still formats the pages as though the sidebar was there, though... I think I'm going to have to really dig into action hooks to "get" this. – JeanSibelius Sep 12 '14 at 18:58
  • I believe, like the bundled themes, this is manipulated by body classes. I will look into that later if you haven't yet found a solution to this. – Pieter Goosen Sep 13 '14 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.