badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

siredgar

Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • siredgar
    Participant

    @sanjip-shah Thanks, that has helped me to fix it now. I used

    <?php
    }

    instead to get it working. If anyone else is trying to multi business page then this is what i have working in the functions.php now:

    <?php;
    function attitude_child_widgets_init() {
    // Registering Business2 Page template sidebar
    	register_sidebar( array(
    		'name' 				=> __( 'Business2 Page Sidebar', 'attitude' ),
    		'id' 					=> 'attitude_business2_page_sidebar',
    		'description'   	=> __( 'Shows widgets on Business2 Page Template. Sutiable widget: Theme Horse: Featured widget, Theme Horse: Testimonial, Theme Horse: Services', 'attitude' ),
    		'before_widget' 	=> '<section id="%1$s" class="widget %2$s">',
    		'after_widget'  	=> '</section>',
    		'before_title'  	=> '<h1 class="widget-title">',
    		'after_title'   	=> '</h1>'
    	) );	
    }
    {
    // Registering Business3 Page template sidebar
    	register_sidebar( array(
    		'name' 				=> __( 'Business3 Page Sidebar', 'attitude' ),
    		'id' 					=> 'attitude_business3_page_sidebar',
    		'description'   	=> __( 'Shows widgets on Business3 Page Template. Sutiable widget: Theme Horse: Featured widget, Theme Horse: Testimonial, Theme Horse: Services', 'attitude' ),
    		'before_widget' 	=> '<section id="%1$s" class="widget %2$s">',
    		'after_widget'  	=> '</section>',
    		'before_title'  	=> '<h1 class="widget-title">',
    		'after_title'   	=> '</h1>'
    	) );	
    }
    add_action( 'widgets_init', 'attitude_child_widgets_init' );
    add_action( 'attitude_business2_template_content', 'attitude_business2_template_widgetized_content', 10 );
    add_action( 'attitude_business3_template_content', 'attitude_business3_template_widgetized_content', 10 );
    /**
     * Displays the widget as contents
     */
    function attitude_business2_template_widgetized_content() { ?>
    	<div id="content">
    		<?php if( is_active_sidebar( 'attitude_business2_page_sidebar' ) ) {
    
    			// Calling the footer sidebar if it exists.
    			if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'attitude_business2_page_sidebar' ) ):
    			endif;
    		}
    		?>
    	</div><!-- #content -->
    <?php
    }
    function attitude_business3_template_widgetized_content() { ?>
    	<div id="content">
    		<?php if( is_active_sidebar( 'attitude_business3_page_sidebar' ) ) {
    
    			// Calling the footer sidebar if it exists.
    			if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'attitude_business3_page_sidebar' ) ):
    			endif;
    		}
    		?>
    	</div><!-- #content -->
    <?php
    }
    ?>

    Thanks for all your help 🙂

    siredgar
    Participant

    @sanjip-shah Thanks, I really appreciate your help on this.

    <?php
    /**
     * Template Name: Business Template2
     *
     * Displays the Business Layout of the theme.
     *
     * @package Theme Horse
     * @subpackage Attitude
     * @since Attitude 1.1
     */
    ?>
    
    <?php get_header(); ?>
    
    <?php
    	/** 
    	 * attitude_before_main_container hook
    	 */
    	do_action( 'attitude_before_main_container' );
    ?>
    
    <div id="container">
    	<?php
    		/** 
    		 * attitude_business2_template_content hook
    		 *
    		 * HOOKED_FUNCTION_NAME PRIORITY
    		 *
    		 * attitude_display_business2_template_content 10
    		 */
    		do_action( 'attitude_business2_template_content' );
    	?>
    </div><!-- #container -->
    
    <?php
    	/** 
    	 * attitude_after_main_container hook
    	 */
    	do_action( 'attitude_after_main_container' );
    ?>
    
    <?php get_footer(); ?>

    In my widget dashboard I can see ‘Business3 page sidebar’ and ‘Business2 page sidebar’ and I can also select page layout as ‘business template2’ or ‘business template3’

    I currently have business 2 at activities> and business 3 at course choice page> I have just put a text widget (title: ‘Course Choice Title’ and text: ‘Course Choice Text’ into the ‘Business3 page sidebar’ this text displays on the activities(business2) page not the course choice page(business3).

    Also displayed on the activities(business2) page is the following snippet from the functions.php:
    add_action( ‘attitude_business3_template_content’, ‘attitude_business3_template_widgetized_content’, 10 ); /** * Displays the widget as contents */ function attitude_business3_template_widgetized_content() { ?>

    siredgar
    Participant

    Hi Sanjip, Thank you for your help. the code from page_template_business3.php is below.

    <?php
    /**
     * Template Name: Business Template3
     *
     * Displays the Business Layout of the theme.
     *
     * @package Theme Horse
     * @subpackage Attitude
     * @since Attitude 1.1
     */
    ?>
    
    <?php get_header(); ?>
    
    <?php
    	/** 
    	 * attitude_before_main_container hook
    	 */
    	do_action( 'attitude_before_main_container' );
    ?>
    
    <div id="container">
    	<?php
    		/** 
    		 * attitude_business3_template_content hook
    		 *
    		 * HOOKED_FUNCTION_NAME PRIORITY
    		 *
    		 * attitude_display_business3_template_content 10
    		 */
    		do_action( 'attitude_business3_template_content' );
    	?>
    </div><!-- #container -->
    
    <?php
    	/** 
    	 * attitude_after_main_container hook
    	 */
    	do_action( 'attitude_after_main_container' );
    ?>
    
    <?php get_footer(); ?>
    siredgar
    Participant

    @sanjip-shah Hi Sanjip, The code unfortunately displays the business3 links on the business2 page. Is there a problem with the php above? thank you!

    siredgar
    Participant

    Thanks Sanjip, I have managed to get it working using the following in the functions.php of the childtheme. I had the order wrong before, seems to be correct now? Thank you

    <?php;
    
    function attitude_child_widgets_init() {
    
    // Registering Business2 Page template sidebar
    	register_sidebar( array(
    		'name' 				=> __( 'Business2 Page Sidebar', 'attitude' ),
    		'id' 					=> 'attitude_business2_page_sidebar',
    		'description'   	=> __( 'Shows widgets on Business2 Page Template. Sutiable widget: Theme Horse: Featured widget, Theme Horse: Testimonial, Theme Horse: Services', 'attitude' ),
    		'before_widget' 	=> '<section id="%1$s" class="widget %2$s">',
    		'after_widget'  	=> '</section>',
    		'before_title'  	=> '<h1 class="widget-title">',
    		'after_title'   	=> '</h1>'
    	) );	
    }
    
    {
    
    // Registering Business3 Page template sidebar
    	register_sidebar( array(
    		'name' 				=> __( 'Business3 Page Sidebar', 'attitude' ),
    		'id' 					=> 'attitude_business3_page_sidebar',
    		'description'   	=> __( 'Shows widgets on Business3 Page Template. Sutiable widget: Theme Horse: Featured widget, Theme Horse: Testimonial, Theme Horse: Services', 'attitude' ),
    		'before_widget' 	=> '<section id="%1$s" class="widget %2$s">',
    		'after_widget'  	=> '</section>',
    		'before_title'  	=> '<h1 class="widget-title">',
    		'after_title'   	=> '</h1>'
    	) );	
    }
    
    add_action( 'widgets_init', 'attitude_child_widgets_init' );
    
    add_action( 'attitude_business2_template_content', 'attitude_business2_template_widgetized_content', 10 );
    /**
     * Displays the widget as contents
     */
    function attitude_business2_template_widgetized_content() { ?>
    	<div id="content">
    		<?php if( is_active_sidebar( 'attitude_business2_page_sidebar' ) ) {
    
    			// Calling the footer sidebar if it exists.
    			if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'attitude_business2_page_sidebar' ) ):
    			endif;
    		}
    		?>
    	</div><!-- #content -->
    
    add_action( 'attitude_business3_template_content', 'attitude_business3_template_widgetized_content', 10 );
    /**
     * Displays the widget as contents
     */
    function attitude_business3_template_widgetized_content() { ?>
    	<div id="content">
    		<?php if( is_active_sidebar( 'attitude_business3_page_sidebar' ) ) {
    
    			// Calling the footer sidebar if it exists.
    			if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'attitude_business3_page_sidebar' ) ):
    			endif;
    		}
    		?>
    	</div><!-- #content -->
    
    <?php
    }
    
    ?>
    
    siredgar
    Participant

    is it possible to have a third business page? please could you tell me what the code forthe functions.php will be? I have tried having the code above twice, once for business2 and once for business3 along with adding the page-template-business2.php and page-template-business3.php files but it only shows business2 widget. Thank you!

    in reply to: Child theme, how to #4805
    siredgar
    Participant
Viewing 7 posts - 1 through 7 (of 7 total)