Support » Theme: Twenty Twelve » Page template and sidebar

  • Hi,

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Andrew Nevins


    Forum moderator

    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.


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

    I don’t find Custom CSS section in dashboard.



    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.

    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 ]



    Forum Moderator

    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') )

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Page template and sidebar’ is closed to new replies.