Adding a New Widget Except to the Home Page

Community Forums Forums Design Tips and Tricks Adding a New Widget Except to the Home Page

This topic is: resolved

This topic contains 7 replies, has 2 voices, and was last updated by  nutsandbolts 8 months, 4 weeks ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #88642

    Lisa at OG
    Participant
    Post count: 118

    Hi there,

    We’ve registered to display a new widget on inside pages of our web design BUT it is also displaying on the home page. We don’t want it to show on the home page. How do we have it display on all pages BUT the home page?

    Can anyone help. I know it’s likely PHP that is required.

    http://www.originalginger.com/demos/ecf/the-journey-of-ecf/
    #88657

    nutsandbolts
    Keymaster
    Post count: 3176

    How did you add the new widget area? If you can paste in what you added to functions.php, I can help you adjust it so it doesn’t show on the homepage.


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

    #88671

    Lisa at OG
    Participant
    Post count: 118

    Hey @nutsandbolts, thanks for the help. Right now I’m using Display Widgets by Strategy 11 and I can control which widgets show where that way BUT it would be great NOT to have to use a plugin for this soooo here is the code I used in functions.php:

    genesis_register_sidebar( array(
    	'id'			=> 'inside-page-banner',
    	'name'			=> __( 'Inside Page Banner', 'legacy' ),
    	'description'	=> __( 'This is the section on inside pages right above the page title tag.', 'legacy' ),
    ) );

    and then I used Genesis Simple Hooks and added the following:

    <div class="inside-page-banner">
      <?php dynamic_sidebar( 'inside-page-banner' ); ?>
    </div>
    • This reply was modified 8 months, 4 weeks ago by  Lisa at OG.
    • This reply was modified 8 months, 4 weeks ago by  Lisa at OG.
    #88675

    nutsandbolts
    Keymaster
    Post count: 3176

    Okay, one more question – what hook are you using? Where is the widget area supposed to display?

    I’ll give you a function you can add to functions.php and skip Simple Hooks. Also, Legacy isn’t HTML5-compatible, right? I’m thinking it’s one of the older XHTML themes but I don’t see questions about it very often so I wanted to be sure.


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

    #88679

    Lisa at OG
    Participant
    Post count: 118

    Hi Andrea,

    It is HTML5 compatible. It was built by one of the StudioPress community developers and is still featured in their themes area I believe. The widget is displaying at the top of inside pages above the Entry Title. Right now it is perfectly placed. I am using the genesis_before_content_sidebar_wrap Hook in simple hooks. It is the hook that executes immediately before the div block that wraps the content and the primary sidebar (outside the #content-sidebar-wrap div).

    #88684

    nutsandbolts
    Keymaster
    Post count: 3176

    Okay, keep what you’ve got in functions.php, remove the snippet from Simple Hooks, and add this to functions.php:

    //* Add the inside page banner and exclude on homepage
    add_action( 'genesis_before_content_sidebar_wrap', 'nabm_add_widget' );
    function nabm_add_widget() {
    	if ( !is_home() && !is_front_page() )
    	genesis_widget_area( 'inside-page-banner', array(
    		'before' => '<div id="inside-page-banner">',
    	) );
    }

    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

    #88690

    Lisa at OG
    Participant
    Post count: 118

    Thanks Andrea. That did the trick. Appreciate your expertise with the php.

    #88691

    nutsandbolts
    Keymaster
    Post count: 3176

    No problem! Glad I was able to help. :)


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.