[resolved] Create function to call theme/templates depending on page (3 posts)

  1. Anonymous
    Posted 8 years ago #

    I have created my own theme that allows one post to show per page. I can change this to show more posts per page in admin. I want to be able to set a new page as the homepage that displays previews of posts (say 5) and that uses a different theme/template/css. Am I write in thinking that to do this I would require a custom function in functions.php. Could anyone help me write it.

  2. tsguitar
    Posted 8 years ago #

    You shouldn't need to mess with functions.php because this all sounds like a CSS issue as far as giving the home page a different design.

    If you want a different styling of your home page, you can just wrap the entire page and use CSS to style things differently. Navigate to your Header and find <body>. Change that to:

    if (!is_home())
    echo "<body id=\"home\">";
    echo "<body>";

    Now you can use CSS to style all elements on the home page differently than all elements elsewhere since everything on the home page can be called on by using #home.

    As far as displaying previews of 5 posts, it's probably query_posts that you want to use:

    Honestly, though, most themes are set up to display excerpts from the latest 5 posts.

    A link to your site would help out.

  3. Anonymous
    Posted 8 years ago #

    That's brilliant thanks a lot!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.