Support » Themes and Templates » How to have separate page for posts (not index.php)

  • Hi,

    I am sure this has been explained many times but I am getting lost trying to find an answer.

    I set up a new site with a heavily modified index to allow for me to only show posts from one category. The basic framework of my index is:

    <?php get_header(); ?>
        <?php global $more;  $more = 0; ?>
    	<?php $portfolio_cat = "3"; $portfolio_num = "14"; ?>
        <?php query_posts('showposts='.$portfolio_num.'&cat='.$portfolio_cat.'');
          while (have_posts()) : the_post();
     <div class="titlebox"> <h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"> <?php the_title(); ?></a></h2></div>
    		   <?php the_content('read more'); ?>
        <?php endwhile; ?>
    <?php get_sidebar(); ?>

    This is serving as my portfolio page. I also want to have a page that shows my posts from every other category.

    I understand how to exclude categories but I am confused by the page structure. I am already using the About page… and if I make another page it only serves as a template.

    What I am asking is how could I make a page, say blog.php, that shows the excerpts of my posts from all of the categories except the exluded one that is a part of the index.php.

    I would really appreciate any advice and perhaps a better way to achieve this.

Viewing 7 replies - 1 through 7 (of 7 total)
  • What I have done in the past:

    1. Create a custom Page Template that will display all of the code on your site home page – in your situation, you can most likely copy all the code from you modified index.php. – Upload this file to your theme’s folder

    2. Create a new WordPress page called “Home”. Select your custom page template from the “Template” drop down under “Attributes” on the right hand side bar of the “Add/Edit Page” screen. Publish your new page.

    3. Create a new WordPress page called “Blog” and publish it. This page’s content box can be left blank.

    4. Navigate to Settings -> Reading in your WordPress admin. The first set of options are “Front page displays”.

    5. You want to select “A static page (select below)” for the radio button input.

    6. Select “Home” for “Front page” and “Blog” for “Posts Page”.

    7. Scroll down to the bottom and press “Save Changes”.

    I’m actually dealing with a problem in 2.7 that’s not allowing this. I’m trying to find some help on this one.

    I have a home.php file that calls the front page (basically a flash gallery front page) and then I created a blog page.

    In the settings, I set the front page to go to the home page I set up, and the Posts Page to point to blog.

    Everything’s right as far as I can tell. All the code is there, etc.

    However, when I go to /blog, I get the home page template.

    Have you tried moving the code that’s in home.php to a page template. You could then apply this template to a new page called home, set that to display as your home page… Just a thought… I never had much luck with home.php

    I found another post that said the above solution works, but it’s a bit buggy if you name the replacement page “Home”. So I deleted the new “Home” page and created “Welcome” and “News” (for the blog) and followed the rest of the instructions. It worked like a charm… if you have enough flexibility to call your home page something other than “Home”. After fiddling with the .php files for a while, I was flexible enough!

    Weird issue… glad you got it working though!

    Hi, guys…I can’t believe this solved it, but I simply renamed “home.php” to “frontpage.php” and it resolved the issue.

    This is something I haven’t seen in anything but WP 2.7 (and that’s from using it since 1.5-ish). Interesting note, though. I’ll keep that one logged away.

    Thanks for all the replies, though.

    I was having the same or similar problem.
    I was using a template ‘blog.php’ on a page titled ‘Blog’ to format the posts page.
    I was using a template ‘home.php’ on a page titled ‘Home’.
    However, every change I made to the ‘Home’ template, also affected the posts page, and ‘blog.php’ template did nothing.
    I changed the name of the ‘Home’ template, ‘home.php’ to ‘homepage.php’ and everything is now functioning as I want.

    Thanks to everyone above!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to have separate page for posts (not index.php)’ is closed to new replies.