WordPress.org

Support

Support » How-To and Troubleshooting » Creating a new .php page that uses template tags

Creating a new .php page that uses template tags

  • Hi all-
    I’m trying to create a separate page called Blog.php that is separate from the main index.php page on a site I’ve created. The front page (index.php) is a 3 column layout, with the two recent blog posts and other stuff in the left and right sidebar (but *no* links to archived entries/etc. in either of those columns – the left is a links column while the right is a “take action on this issue” thing).

    The blog.php page is the sort of “blog landing page;” e.g. when a user clicks on the link it will show the most recent blog posts (probably 2 or 3), the same left column from the index.php page, while the right column is going to be different than index.php’s – instead it will have the links to archives by category/date/etc.

    I should note here that the left sidebar/column is pulled from sidebar.php while the right column is written directly into the index.php page.

    How do I set up a page to do this? I’ve tried duplicating page.php, renamed it blog.php and used <?php include ___;?> instead of get for the header/sidebar/footer. I then created a new Page using this template, and it comes out fine, except it doesn’t show any of the recent blog posts even though

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php the_content(); ?>
    <?php endwhile; endif; ?>

    is in there.

    Any suggestions?

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Creating a new .php page that uses template tags’ is closed to new replies.
Skip to toolbar