- This topic has 21 replies, 4 voices, and was last updated 10 years, 12 months ago by rwendeln.
-
AuthorPosts
-
November 25, 2013 at 12:09 pm #5363siredgarParticipant
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(); ?>
November 26, 2013 at 6:17 am #5373Sanjip ShahParticipant@siredgar All looks fine to me, can you check the code ofpage_template_business2.php file.
November 26, 2013 at 11:35 am #5377siredgarParticipant@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() { ?>November 27, 2013 at 6:15 am #5392Sanjip ShahParticipant@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 codefunction 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 -->
November 27, 2013 at 11:30 am #5393siredgarParticipant@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 🙂
November 28, 2013 at 8:17 am #5415Sanjip ShahParticipant@siredgar Okay. Great.
December 19, 2013 at 5:31 pm #5728rwendelnMemberI 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.
-
AuthorPosts
- You must be logged in to reply to this topic.