Support » Themes and Templates » Question about pages struture.

  • Hi guys!!

    I am trying to edit my blog with CSS.

    I have a blog with different pages (home / about / blog / Bio). I’ve expanded the external widht, from 760px to 860px. I would like have different widhts of pages, refering about the place to write (widecolumn or narrowcolumn), for instance; HOME, ABOUT and BIO pages could have a 760px widht and the blog 540px widht (default). My question is how can I program differents width for each page?, How do I refer to each page with CSS?

    Thanks guys!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You could use the body_class() in your theme’s header.php which would allow you to style on .page-id-nn where nn = your page id. eg: if the Blog page has an id of 7 and the About page has an id of 5:

    page-id-7 div {width:540px;}
    .page-id-5 div {width:760px;}

    Or you could set up the appropriate classes in your stylesheet and then then apply them using the is_page() conditional:


    .narrowcolumn {width:540px;}
    .widecolumn {width:760px;}

    In PAGE.PHP:

    <div class="<?php if( is_page('Blog') ) echo 'narrowcolumn';else echo 'widecolumn'; ?>">
    [ do post content stuff ]

    You need to create templates that can be easily chosen for pages.

    You also have to create new headers (that would be called in the templates) that reflect the width you like.

    Experiment with a theme that has different page templates to get a feel of this.


    I am still trying to modify the structure of diferent pages, but I am not doing well… I cant :(.

    Esmi…How I can use the body_class() ?? where??

    I would like to modify each pages (home, about, blog…) in differents parts of the code.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Question about pages struture.’ is closed to new replies.