• Resolved danefoster

    (@danefoster)


    Although I’m newer to wordpress, just wanted the community to know that I take forum protocols seriously. I am using a TwentyEleven child theme for the following site, https://www.groldschool.com. I have searched exhaustively and cannot seem to find a solution to the following:

    In the Theme Options for Twenty Eleven you have the choice for right sidebar, left sidebar, or none (full width). I would like to use different templates on different pages, ie on the About or Tuition page I would like to have a full width template while keeping the right sidebar on the homepage.

    Here is the issue, I copied the Sidebar Template Page Template, removed the <?php get_sidebar(); ?> line and saved as page-fullwith.php. This Full Width page shows up for my choice of templates but does not change anything. Am I editing the wrong php file? Or is it more complex because of the way the theme itself calls the three different options? Thank you, Dane

Viewing 11 replies - 1 through 11 (of 11 total)
  • but does not change anything

    Sorry? Can you elaborate on that?

    Thread Starter danefoster

    (@danefoster)

    Yes, sorry. After I made my custom page template (meaning the Sidebar Template with the above line of php removed) and applied it to the About page, the layout still has the sidebar on the right side. Right now I do not have anything in the sidebar, but the other content is restricted to the left side and does not expand to the full width.

    The sidebar has almost certainly been removed but now you need to add some extra CSS to your child theme to extend the content area’s width to take advantage of the extra space. If you check classes on the body tag in the source of the generated page, you should see a whole string of classes that you can use to target your CSS. One of those classes will be the file name of the new template. Use it to restrict your CSS to just pages using this template.

    Thread Starter danefoster

    (@danefoster)

    esmi, I genuinely appreciate your time and attempting to help me. I don’t believe that changing the CSS will help as ALL pages appear the same because the theme options are set to the right sidebar, but I will change my CSS to 100% width later this evening and see what happens and the post the results.

    Try using Firefox with the Firebug add-on for this kind of CSS troubleshooting. Or use whatever developer tool is available in your web browser. You’ll see that the content area has a specific width defined in the CSS. This width will be used whether or not the sidebar is actually on the page – unless you amend it using tightly targeted CSS.

    Thread Starter danefoster

    (@danefoster)

    alchymyth, first off thank you so very much, you are awesome. Second, I followed all of these links and am fairly sure that I will be able to work something out. Third though, I have a final question on this topic–you were posed the question, as a comment on your first link #51 tutorial, how you would accomplish the same thing removing the sidebar completely. You responded:

    ‘what is the problem? if you create a page template, for instance starting with the code of page.php, then there is no call for the sidebar, and therefore no sidebar.’

    You are correct, the page.php has no sidebar call, yet when I create a new child template using page.php and name it ‘page-fullwidth’ my content is still huddled left even though my CSS for #primary is liquid using a percentage and should fill the width.

    So do I need to do some other modification like in your tutorial #54 as a work around?

    I think you are the one person who truly grasps the question–I am using a Twenty Eleven child, the theme option is set for right sidebar, but I simply want a template option for full width!

    Thank you again, I genuinely appreciate your time.

    a page template will get a body_class which reflects the page template’s file name;

    for example your ‘about’ page has a body_class of .page-template-page-no-sidebar-final-php

    use that as a base to widen the content section for a ‘no-sidebar’ page template:

    .page-template-page-no-sidebar-final-php.singular .entry-content,
    .page-template-page-no-sidebar-final-php.singular .entry-header,
    .page-template-page-no-sidebar-final-php.singular .entry-content,
    .page-template-page-no-sidebar-final-php.singular footer.entry-meta,
    .page-template-page-no-sidebar-final-php.singular #comments-title {
      width: 100%;
    }
    Thread Starter danefoster

    (@danefoster)

    alchymyth, I cannot thank you enough for your time, and effort to help others. I guess my point was to try to ‘fix’ this by editing the php files and/or by page templates so that I wouldn’t have to load in tons of specialized CSS, like the way you fixed this issue in your tutorials. This way I could simply select a page template and be done.

    I just copied this CSS into my child theme and I still have the same result, no dice. I guess the simplest question is what php file actually controls the page layout when using the default layout with the ‘right sidebar’ option selected? In the <body class> even though it seems to be calling my custom template, after that it still reads:

    <body class=”page page-id-5 page-template page-template-page-no-sidebar-final-php logged-in admin-bar single-author singular two-column right-sidebar customize-support”>

    So again, I guess the very simplest question is what php file controls default theme, right sidebar layout?

    ‘fix’ this by editing the php files and/or by page templates so that I wouldn’t have to load in tons of specialized CSS

    there is nothing in the php to fix the width of a single column page; the moment, the body_class .singular is applied, the page content is narrowed by the CSS.
    a few lines of CSS are more effective than any attempt to do this in the php files.

    I just copied this CSS into my child theme and I still have the same result, no dice.

    the width of #primary seems to be disturbing the layout of the page template;

    try to add these styles at the end of style.css of the child theme:

    .page-template-page-no-sidebar-final-php.singular #primary,
    .page-template-page-no-sidebar-final-php.singular .entry-content,
    .page-template-page-no-sidebar-final-php.singular .entry-header,
    .page-template-page-no-sidebar-final-php.singular .entry-content,
    .page-template-page-no-sidebar-final-php.singular footer.entry-meta,
    .page-template-page-no-sidebar-final-php.singular #comments-title {
      width: 100%;
    }

    and clear the browser cache (by pressing ‘reload’ a few times, or by pressing CTRL F5)

    what php file controls default theme, right sidebar layout?

    functions.php sets the body_class output acccording to the chosen layout option; style.css uses those CSS classes to format the site.

    Thread Starter danefoster

    (@danefoster)

    I would like to thank alchymyth for all the time and effort in helping me, I genuinely appreciate it. In the end, and for all other WordPress users searching for information on these forums, I ended up switching to the Twenty Twelve theme. I honestly created a child theme, re-wrote all my custom CSS, and resolved everything in less time than it took to attempt to figure out the ultra convoluted Twenty Eleven–which like most new users I picked arbitrarily.

    Twenty Twelve has changed my life. EVERYTHING is more clear and concise for all types of editing from CSS to PHP to the default options. I have figured out and resolved my sidebar issue.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Complex Page Template Question’ is closed to new replies.