WordPress.org

Forums

Twenty Fourteen
Widgetizing The Home Page (2 posts)

  1. Tyler Regas
    Member
    Posted 10 months ago #

    I am trying to create a child theme that implements a custom homepage template. In place of the content area which displays The Loop, I want to add two additional columns of widgets identical to the Complementary widget bar on the right. I have generated the child theme code on a testing site so I'm ready to build, but have been having an issue.

    I can't find any documentation on how to create the template page I'm looking for because the search terms are too generic :)

    I know. It's a dumb problem, but if anyone has any suggestions for where I can locate this information, that would be really great. Back in the old days of WordPress we used to have to add the widget code to our themes manually. Since this is all rolled in now, I can't seem to find anything helpful.

    Thanks!

  2. Tche111
    Member
    Posted 8 months ago #

    Hi Tyler,
    I have added two template to my twentyfourteen-child. You can copy the following code in a txt file and rename it as per following
    The first one I called: template-page2.php. It has no sidebar at all.

    <?php
    /**
    Template Name: Sans sidebar
     * The template for displaying all pages
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages and that
     * other 'pages' on your WordPress site will use a different template.
     *
     * @package WordPress
     * @subpackage Twenty_Fourteen
     * @since Twenty Fourteen 1.0
     */
    
    get_header(); ?>
    
    <div id="main-content" class="main-content">
    
    <?php
    	if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
    		// Include the featured content template.
    		get_template_part( 'featured-content' );
    	}
    ?>
    	<div id="primary" class="content-area">
    		<div id="content" class="site-content" role="main">
    
    			<?php
    				// Start the Loop.
    				while ( have_posts() ) : the_post();
    
    					// Include the page content template.
    					get_template_part( 'content', 'page' );
    
    					// If comments are open or we have at least one comment, load up the comment template.
    					if ( comments_open() || get_comments_number() ) {
    						comments_template();
    					}
    				endwhile;
    			?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    </div><!-- #main-content -->
    
    <?php
    get_footer();

    I called the second one, template-page3.php. It only has a sidebar on the right.

    <?php
    /**
    Template Name: Sidebar à droite (seule)
     * The template for displaying all pages
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages and that
     * other 'pages' on your WordPress site will use a different template.
     *
     * @package WordPress
     * @subpackage Twenty_Fourteen
     * @since Twenty Fourteen 1.0
     */
    
    get_header(); ?>
    
    <div id="main-content" class="main-content">
    
    <?php
    	if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
    		// Include the featured content template.
    		get_template_part( 'featured-content' );
    	}
    ?>
    	<div id="primary" class="content-area">
    		<div id="content" class="site-content" role="main">
    
    			<?php
    				// Start the Loop.
    				while ( have_posts() ) : the_post();
    
    					// Include the page content template.
    					get_template_part( 'content', 'page' );
    
    					// If comments are open or we have at least one comment, load up the comment template.
    					if ( comments_open() || get_comments_number() ) {
    						comments_template();
    					}
    				endwhile;
    			?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    	<?php get_sidebar( 'content' ); ?>
    </div><!-- #main-content -->
    
    <?php
    
    get_footer();

    I also added widgets to the footer and explained how here:
    http://wordpress.org/support/topic/functionsphp-child-theme?replies=12#post-5833202

    It may help... I hope it does. :)
    T'Cheers

Reply

You must log in to post.

About this Theme

About this Topic