Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adding a New Widget Except to the Home Page
- This topic has 7 replies, 2 voices, and was last updated 10 years, 2 months ago by nutsandbolts.
-
AuthorPosts
-
February 4, 2014 at 6:50 pm #88642Lisa at OGMember
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/February 4, 2014 at 8:54 pm #88657nutsandboltsMemberHow 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/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+February 4, 2014 at 9:12 pm #88671Lisa at OGMemberHey @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>
February 4, 2014 at 9:15 pm #88675nutsandboltsMemberOkay, 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/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+February 4, 2014 at 9:17 pm #88679Lisa at OGMemberHi 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).
February 4, 2014 at 9:29 pm #88684nutsandboltsMemberOkay, 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/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+February 4, 2014 at 9:38 pm #88690Lisa at OGMemberThanks Andrea. That did the trick. Appreciate your expertise with the php.
February 4, 2014 at 9:39 pm #88691nutsandboltsMemberNo problem! Glad I was able to help. 🙂
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+ -
AuthorPosts
- The topic ‘Adding a New Widget Except to the Home Page’ is closed to new replies.