StudioPress Community Forums
  StudioPress Community Forums > Forums > General Discussion
For help and support, access to your downloads, or to manage your account please log into My StudioPress.

These forums have been set to read-only so you can browse the existing topics for any questions you may have.

For general discussion on WordPress, CSS and design (NOT for support) visit the new Community Forums.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-14-2012, 05:18 PM
steveshead's Avatar
steveshead steveshead is offline
Registered User
GenesisConnect
Pro Plus Member
 
Join Date: Nov 2010
Location: Oakland, CA
Posts: 89
Default Widget on all pages except home

Hi there,

I'm trying to create widget that appears on all pages except the home page. This is the code I thought would work, but didn't:

PHP Code:
/** Add widget area for all pages except the home page */
add_action('genesis_after_header''include_page_header'); 
function 
include_page_header() {
        if ( !
is_home() )
                
remove_action'genesis_after_header''include_page_header' );

By mistake I used the code below and it worked, but I think it's not the best way of achieving what I want:

PHP Code:
/** Add widget area for all pages except the home page */
add_action('genesis_after_header''include_page_header'); 
function 
include_page_header() {
     if (! 
is_home() )

       
genesis_widget_area'page-header', array(
           
'before' => '<div class="page-header widget-area">',
       ) );

I'm quite the novice when it comes to coding, but don't want to settle for something that just works - especially since I'm not sure why it works. I'm sure there's a better way.

The reason I came across the second one was accidentally forgetting the term "return" before the "genesis_widget_area" statement.

Can someone tell me why the first code block doesn't work? Did I miss something? Also, it would be education to find out why the second block did work. Finally - what is the best way to achieve a widget that appears on all pages except the home page?

Thanks in advance!

Oh - the site is http://steves-sandbox.com/industrial.

Steve
__________________
http://steves-sandbox.com
http://freedom2design.com
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
add pages to home sidebar widget muchhelp General Discussion 4 05-16-2009 10:59 AM


All times are GMT -5. The time now is 10:07 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.