Twenty Twelve
Page template and sidebar (6 posts)

  1. asom77
    Posted 3 years ago #


    I created a simple child theme to move the sidebar to the left.

    Now, I want to use a static page for homepage to display an extra sidebar to the right making it a three column only for that page.

    I have registard a widget area in functions.php
    Added the sidebare code to sidebar-right.php

    I need to decrease the content area to accomodate the right sidebar.

    Could you please tell me how to do that?
    Copy the page.php, add body class and css?

    Thanks a lot.

  2. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

    Use a Browser Inspector tool like FireBug to see the current <body> element's classes.

    Remember to add your CSS within the Custom CSS section of the dashboard.

  3. asom77
    Posted 3 years ago #


    How to add filter in functions.php to apply custom css to particular template?

    I don't find Custom CSS section in dashboard.

  4. WPWebs
    Posted 3 years ago #

    if you have create child theme then you can adjust sidebar width via css from style.css even you can flot it left or right as per you want.

  5. asom77
    Posted 3 years ago #

    I found the filter which worked but I had to add it to main theme function.php
    If I add under child theme it shows error.

    function mytheme_body_class( $classes ) {
         if( is_page_template('homepage.php') )
              $classes[] = 'custom-layout';
        return $classes;
    add_filter( 'body_class', 'mytheme_body_class' );

    [please remember to mark all posted code - see http://codex.wordpress.org/Forum_Welcome#Posting_Code ]

  6. Michael
    Forum Moderator
    Posted 3 years ago #

    your conditional if( ! is_page_template('homepage.php') ) is checking the negative 'if it is not homepage.php';

    remove the negation operator ! like so:

    if( is_page_template('homepage.php') )

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic