Community Forums › Forums › Archived Forums › Design Tips and Tricks › add home-slider and home-welcome to all pages in agency
- This topic has 1 reply, 2 voices, and was last updated 10 years, 9 months ago by Brad Dalton.
-
AuthorPosts
-
July 23, 2013 at 1:12 pm #52120KarenLeighBurtonMember
I have a client who wants the home-welcome area and the home-slider to appear on all pages/posts within the agency theme. I am not strong with php and calls/hooks, so I need someone to dumb it down. What needs to be included in the page/post template and what needs to go in the functions to make this happen?
I thought adding this to a page.php file would do the trick...
http://www.tanyamalcolm.com<?php /* WARNING: This file is part of the core Genesis framework. DO NOT edit this file under any circumstances. Please do all modifications in the form of a child theme. */ /** * This file handles pages, but only exists for the sake of * child theme forward compatibility. * * This file is a core Genesis file and should not be edited. * * @category Genesis * @package Templates * @author StudioPress * @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later) * @link http://www.studiopress.com/themes/genesis */ function agency_home_genesis_meta() { if ( is_active_sidebar( 'home-welcome' ) || is_active_sidebar( 'home-slider' ) || is_active_sidebar( 'home-left' ) || is_active_sidebar( 'home-middle' ) || is_active_sidebar( 'home-right' ) ) { remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_after_header', 'agency_home_welcome_helper' ); add_action( 'genesis_loop', 'agency_home_loop_helper' ); add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); add_filter( 'body_class', 'add_body_class' ); function add_body_class( $classes ) { $classes[] = 'agency'; return $classes; } } } function agency_home_welcome_helper() { if ( is_active_sidebar( 'home-welcome' ) ) { echo '<div id="home-welcome">'; dynamic_sidebar( 'home-welcome' ); echo '</div><!-- end #home-welcome -->'; } if ( is_active_sidebar( 'home-slider' ) ) { echo '<div id="home-slider">'; dynamic_sidebar( 'home-slider' ); echo '</div><!-- end #home-slider -->'; } } genesis();
July 23, 2013 at 1:53 pm #52124Brad DaltonParticipantThe reason they only display on home is because they are in the home.php file.
You will need to take the code and use it in a custom function in your child themes functions.php file
You will also need to use a conditional tag so it displays site wide, but not on your home page.
Use the same classes as generated in your home.php file.
Another option is to remove the code which generates these 2 widgets from your home.php file and add it to your functions.php file using the same classes so you don't need to add CSS. You can then add hooks to the code and won't need a conditional tag as its site wide.
I've done this before many times and written several posts on how to do it different ways.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.