• Hi ya

    What is the easiest way to have a different template for the blog page. I understand the blog uses the index.php file so you could modify it and put it in your child theme but it is still going to use the css from the main template.

    I need to be able to have a different top navigation as well as a different layout. The static pages have a top navigation with a left sidebar and a fluid width. The blog needs a maximum width and a right sidebar with a different top navigation.

    Is it just easier to have two installations of WordPress one for the main website and one for the blog.

    I am new to WordPress but experienced in Joomla so am feeling a little out of my depth.

    Any help yes please 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • it is still going to use the css from the main template

    So apply new CSS via your child theme’s stylesheet.

    Thread Starter terryrook

    (@terryrook)

    Thanks Esmi

    Yes I understand how to change the css in the child theme. But if the layout needs to be completely different on the blog page to the main static pages then surely you need to use two templates.

    For instance the css for the the static pages:

    .site {
        margin: 0 auto;
        max-width: 80%;
        overflow: hidden;
    }

    Blog page:

    .site {
        margin: 0 auto;
        max-width: 980px;
        overflow: hidden;
    }

    Also the layout of the sidebar and widths of the content all need to be different as well as the top navigation.

    This lead me to the conclusion that having two installations of WP would be easier but there may well be a better way.

    But if the layout needs to be completely different on the blog page to the main static pages then surely you need to use two templates.

    WordPress already does. The blog (main posts page) uses index.php whilst static pages use page.php. All you have to do is amend the CSS for your blog page via your child theme.

    Thread Starter terryrook

    (@terryrook)

    Thanks Esmi

    I can see how you would change the width of the main content of the blog by changing the class in the index.php file then amending the css in the child. Then I could add a different sidebar and tell it to float right instead of left etc.

    But how can I have a different page width on the blog to the static pages. The page width is controlled by .site and the index.php file doesn’t refer to it.

    Thanks again

    Have you tried looking at the classes generated on the opening <body> tag?

    Thread Starter terryrook

    (@terryrook)

    Yes I am using the Twenty Twelve template and the body tag controls background color, fonts margin etc. The width is controlled by .site

    The problem being is I cant see how you would change the width of the class .site for just the blog page.

    Is there a way of assigning a particular template for a particular page?

    I also dont understand how I would have a different top menu on the blog page to the static pages. I get how I would have a different sidebar.

    Thanks Esmi I realise this is an odd request.

    What classes are being generated on the blog page’s body tag?

    Thread Starter terryrook

    (@terryrook)

    Ah yes there is a difference there. Managed to change the width of the blog page by adding some css to the child:

    [ Code fixed, you have to end it with a backtick and not a single quote ]

    body.blog .site {
        margin: 0 auto;
        max-width: 900px;
        overflow: hidden;
    }

    Thanks Esmi your a star.

    How can I have a different top menu on the blog page. The static pages has the main menu set to the top navigation. I need a different top menu on the blog page and have no idea how to achieve this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Different Template for Blog’ is closed to new replies.