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*

Possible to have a second business page (with different widget pages)??

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #5363
    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(); ?>
    #5373
    Sanjip Shah
    Participant

    @siredgar All looks fine to me, can you check the code ofpage_template_business2.php file.

    #5377
    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() { ?>

    #5392
    Sanjip Shah
    Participant

    @siredgar In this post https://www.themehorse.com/support-forum/topic/possible-to-have-a-second-business-page-with-different-widget-pages/#post-5308
    Please add the opening php tag <?php just after this code

    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 -->
    #5393
    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 🙂

    #5415
    Sanjip Shah
    Participant

    @siredgar Okay. Great.

    #5728
    rwendeln
    Member

    I am trying to duplicate this procedures (to create multiple “business pages”) and have been successful all the way through the final code for functions.php. I’ve appended the additional code for the additional business pages to the end of the functions.php file.

    When I insert the code through the three “add_action” commands from the previous post, everything appears to work fine.

    However, when I insert the code for “Display the widgets as content” coding” through the end, the Appearance dashboard for the theme doesn’t show.

    Here’s how the close of my functions.php file presently looks (and appears to working alright).

    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 );

    ?>

    Thanks for your help.

Viewing 7 posts - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.