Home Forums Expert Carpenter Sidebar in home page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #20777
    Heli Hautala
    Participant

    Hello,

    Is it possible to add right sidebar to homepage template? If I use the “Page with right sidebar” template, cannot use the Slider Banner and I need it.
    Tried to add following code to my child themes home-template.php file but that doesn’t do the trick.

    Br, Heli

    <?php
    /**
     * Template Name: Home Page
     *
     * @package Luzuk
     */
    
    get_header();
    	// echo 'dfajsdlfjlajsdlfjla';
    	$lz_fitness_home_sections = lz_fitness_home_section();
    	// print_r($lz_fitness_home_sections);
    	foreach ($lz_fitness_home_sections as $lz_fitness_home_section) {
    		// echo 'lz_fitness_home_section-> '. $lz_fitness_home_section;
    		get_template_part( 'template-parts/section', $lz_fitness_home_section );
    	}
    
    ?>
    <div class="col-md-3">
    	<?php  get_sidebar(); ?>
    </div>
    <div class="clearfix"></div>
    
    <?php get_footer(); ?>
    #20871
    User Support
    Participant

    Hello heli
    You almost got it. You will need to keep the sidebar and the sections in two columns but you added only one as col-md-3 for side bar, also they need to be inside a row. doing this might change the look of your home page and also might disturb the styles of it as far as the responsiveness is concerned it might get disturbed too. but if you really wanna do it then please check the code below we did some changes in your given code you will get the idea.

    get_header();
    <div class=”row”>
    <div class=”col-md-9″>
    // echo ‘dfajsdlfjlajsdlfjla’;
    $lz_fitness_home_sections = lz_fitness_home_section();
    // print_r($lz_fitness_home_sections);
    foreach ($lz_fitness_home_sections as $lz_fitness_home_section) {
    // echo ‘lz_fitness_home_section-> ‘. $lz_fitness_home_section;
    get_template_part( ‘template-parts/section’, $lz_fitness_home_section );
    }

    ?>
    </div>
    <div class=”col-md-3″>
    <?php get_sidebar(); ?>
    </div>
    </div>
    <div class=”clearfix”></div>

    <?php get_footer(); ?>

    Thank you

    #20873
    Heli Hautala
    Participant

    Ok, thank you very much for your help 🙂
    I´ll give it a try and check the responsiveness.

    br,
    Heli

    #20903
    User Support
    Participant

    Hello Heli
    Thank you for contacting us.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.