WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to add two-column template? (3 posts)

  1. Mohamad Hanafi
    Member
    Posted 1 year ago #

    Dear all forumers,

    Curently I have two template layouts
    - three column (two sidebars)
    - one column (full width)

    Now I need to add two column layout template which has left sidebar.

    How to do it?

    My Theme: Box Of Boom.

    Thanks in advanced.

  2. RichardWPG
    Member
    Posted 1 year ago #

    Do you know any basic html? Or you can use WP-Table Reload Plugin.

  3. Mohamad Hanafi
    Member
    Posted 1 year ago #

    Hi, Richard.

    Thanks for you respond.

    This issue resolved.

    1. Add <subpage-name>.php in wp-content/themes/<theme-name>

    Write

    <?php
    /**
     * Template Name: <subpage-name>, left sidebar
     * Description: A one-colum template with left sidebar for <subpage-name> ONLY
     */
    get_header(); ?>

    2. Copy full-width page basic codes.
    3. Add new div for

    <div id="main" class="<subpage-name>-right clearfix" role="main">
    
    				<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php get_template_part( 'content', 'page' ); ?>
    
    				<?php comments_template( '', true ); ?>
    
    				<?php endwhile; // end of the loop. ?>
    
    			</div>
    		<div id="main" class="<subpage-name>-left clearfix">
    </div>

    4. Set style in css.

    div#main.<subpage-name>-left{width:240px;float:left;}
    div#main.<subpage-name>-right{width:780px;float:right;}
    article{margin-top: -44px;}

    Thanks.

    Hanafi.
    KL.

Topic Closed

This topic has been closed to new replies.

About this Topic