• I’m working on a new theme for my WP site. I’m new WP and not sure how everything works just yet. I’ve been reading the Codex and found many answers there to my questions but this one I can’t find.

    I’d like to list my recent posts on a page called “Recent”. Then I’d like to use the plugin called “Static Front Page” to set my “Recent” page as the default page. The problem is I don’t know how to get my posts to show on the “Recent” page. I’ve copied the code from the index page, hoping that would work but it didn’t. Can anyone point me toward answer? Perhaps there is something I missed in the Codex?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Okay, by default, WordPress shows your recent posts on the front page. You want another page to show recent posts? That’s redundant. Maybe you are thinking of creating an archive page:

    https://codex.www.ads-software.com/Creating_an_Archive_Index

    You can also get a list of recent post titles in your sidebar using the Customizable Post Listings plugin from:
    https://www.coffee2code.com/wp-plugins/

    Thread Starter jheyer

    (@jheyer)

    Hi Lorelle,

    Yes I know that, by default, WP shows my recent posts but the problem is I’d like the “Recent” page item to be selected so people know which page they are viewing in my list of pages. Basically since I don’t know any other way to select the menu item other than to create a Page to do it. That is the reason I’m trying it this way, though I haven’t been able to yet. You can see what I mean by going here. The site is under a live redesign so much of it doesn’t work properly or at all.

    Btw, I don’t make use of a sidebar in my design. I prefer moving items from the sidebar to their own Pages.

    I know what you are saying jheyer & I would love to do the same thing. Just to summarize what I am looking for (and hopefully clear up any questions):

    I am using the Static Front Page plugin and I want to create a Page that mimics the appearance of the index page of a normal WP install. As per the FAQ of Semiologic I am going to use one Category to post all entries to. Instead of linking to the archive as the FAQ suggests I would prefer to have a Page that displays that same information (for the sole purpose of having the nice permalink that matches the other Pages permalinks). I want to be able to control the number of results (with full posts). I am using WP 1.5.1.2, default theme. Also, will sub-categories display?

    For example I want to create a Page (based on lets say a template called page-news.php) that displays the last 5 posts in the News Category (or any subcategories of News). I want it to look the same as the other pages of the default template, displaying the full posts in the left (wide) column and all the same right (narrow) information as the rest of the site (archives, etc.). Is this possible?

    I’m also just looking to display the titles and links to posts in a category on a page. It’d be like a table of contents instead of listing the content of all the posts in a category.

    I thought the home.php template does exactly that.
    1. You create a home.php template file (e.g. saving your theme’s index and editing it)
    2. Use a custom query_posts and use only the title, permalink (date?) template tags – but not the_content…
    and you are done.

    Ok, I finally found the solution (for me anyway) thanks to this thread.

    The following code is for a Page template named “News” which pulls the 5 most recent posts for the Category named “News”.


    <?php
    /*
    Template Name: News
    */
    ?>

    <?php get_header(); ?>

    <div id="content" class="narrowcolumn">
    <h2 class="pagetitle">News</h2>

    <div class="post">
    <?php $my_query = new WP_Query('category_name=News&showposts=5'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <h3 id="post-<?php the_ID(); ?>">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    <?php the_title(); ?>
    </h3>
    <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

    <div class="entry">
    <?php the_excerpt() ?>
    </div>

    <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit','','|'); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
    <?php endwhile; ?>
    </div>
    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    Yeah, you can do that.

    You can also have the HOME button on your navbar be active/selected when is_home() is true. Or any other set of checks you feel like that indicate the ‘home page’. Or use the home.php template to set a variable that says you’re on the homepage, then calls one of the other theme files (like index.php)….

    just some alternate approaches, if the navbar is what you care about…

    -d

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Listing Posts on Static Page’ is closed to new replies.