add home-slider and home-welcome to all pages in agency

Community Forums Forums Design Tips and Tricks add home-slider and home-welcome to all pages in agency

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  braddalton 1 year, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #52120

    KarenLeighBurton
    Participant
    Post count: 19

    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…

    <?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();
    
    http://www.tanyamalcolm.com
    #52124

    braddalton
    Participant
    Post count: 10254

    The 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.


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

You must be logged in to reply to this topic.