• Resolved Runtheball

    (@eisenbart)


    I’m new to the twenty ten theme, having always hard-coded my sidebars in the past. With twenty-ten it seems like it should be pretty easy to create one page without a sidebar: just select the page in Admin, select Edit, then choose the “one column no sidebar” template on the right hand column under Page Attributes. Easy enough, so why doesn’t it work?

    The site I’m building has a sidebar on all pages except the blog page, and single blog post pages. Selecting ‘one column no sidebar’ results in some subtle changes to the code for the blog page, but the sidebar is still there. Here is the code for the BODY tag on pages using the default template…

    <body class="page page-id-64 page-template page-template-default logged-in admin-bar">

    …and here is the BODY tag for the blog page…

    <body class="blog logged-in admin-bar">

    So choosing ‘one column no sidebar’ does SOMETHING, but it doesn’t remove the sidebar. It seems as if it prevents the page from using the default template, but doesn’t allow it to use any other template. What could cause this?

    And where should I look for the solution? I’m even willing to hard-code the elimination of the blog page sidebar…but I shouldn’t have to.

Viewing 4 replies - 1 through 4 (of 4 total)
  • the blog page is run by index.php (as far as i know)
    – to get a single column blog page, you might need to copy index.php and save it as home.php;
    then remove the ‘get-sidebar’ code,
    and add a class .one-column to:

    <div id="container" class="one-column">

    Thread Starter Runtheball

    (@eisenbart)

    That was easy, and I should have thought of it myself. After wasting a couple hours…I didn’t.

    Thank you!!!

    Thread Starter Runtheball

    (@eisenbart)

    Well…there was still a problem. I followed your instructions and created a new template page called blogtemplate.php, but that page doesn’t show on the Attributes menu. I still only see ‘default template’ and ‘one-column no sidebar’ in that menu.

    Now I’ve found this page of the codex that states “Users cannot modify the templates or add their own. You can only select from the list, which depends on the theme you have activated.”

    So I just modified the index.php file (since only my blog page was actually using it) per your instructions and now I have a blog page without a sidebar. I made the same modifications to the single.php file, and now the single-posts also have no sidebar. Other pages (e.g. ‘privacy policy’) can successfully use the ‘one-column no sidebar’ template…it was only the blog page and single post pages that couldn’t use it.

    Thanks again for pointing me in the right direction.

    i didn’t mention ‘blogtemplate.php’ – i said ‘home’php’ which is one of the templates that have their special roles in wordpress.

    however, generally, any page template would need lines like these at the top, to be recognized for the template dropdown list:

    <?php
    /*
    Template Name: Blog Template*/
    ?>

    http://codex.wordpress.org/Pages#Page_Templates

    also, when you create a page template, probably to show your posts, you may need to add a query before the loop.

    http://codex.wordpress.org/Function_Reference/query_posts
    http://codex.wordpress.org/Function_Reference/WP_Query


    the above does not apply if you are using index.php or home.php

    …it was only the blog page and single post pages that couldn’t use it.

    and – if you use them – archive.php, author.php, category.php, search.php, tag.php .

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Twenty Ten – One column no sidebar – not working’ is closed to new replies.