• This seems like the most basic concept in WordPress and I can’t figure it out.

    How do I link to an archive page that shows every single post on the blog in chronological order? I know how to link to the archives page to show all posts by author (<?php the_author_posts_link(); ?>), by date (<?php the_time(‘F j, Y’); ?>), by category (<?php $category = get_the_category(); $category_id = $category[$i]->cat_ID; echo get_category_link($category_id);?>), and so on. I cannot figure out how to link to it to simply show every post that exists in the blog, not sorted by author, date, or anything else. Just every post there is, in chronological order?

    Can anyone explain how to link to this page? Thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Um – that would be your index.php template file that typically drives your site’s front page or your blog page (if you have created a static front page).

    Thread Starter earthtojeremy

    (@earthtojeremy)

    Yeah, the problem is my site is a bit more complex. It’s a bit like a magazine site, and the index.php page only features the 4 latest posts. I need to add a button to the top of these posts that says “View blog index” and go to a separate archives page which will display every single post in the blog.

    I know that the archives.php page can do what I want it to do. It’s set up to check if the user is trying to view the archives by author, category, etc., and if none of those, then simply display every single post there is. The problem is I don’t understand what sort of link to use to tell the archives page to display everything.

    The WordPress Default theme has an archives.php that can be used as a page template so create a page call All Posts, assign that template to the page, then change that template to use

    <?php wp_get_archives('type=postbypost'); ?>

    Thread Starter earthtojeremy

    (@earthtojeremy)

    Here is the index.php front page of my site so you can see what I mean: http://singlebarreldetroit.com/dev/wordpress/

    As MichaelH pointed out above, create a Page Template, add in your theme’s div structures, then the code posted above.

    Thread Starter earthtojeremy

    (@earthtojeremy)

    Two problems with this:

    1. I can’t get it to work. I edited page.php in the theme so that it has my site’s div structure, which works fine when I add text content to a new Page. When I add <?php wp_get_archives(‘type=postbypost’); ?> in a Page post (I assume I’m supposed to add this via the HTML tab and not the Visual tab?), the post area of the Page is simply blank.

    2. To troubleshoot, I edited page.php and inserted <?php wp_get_archives(‘type=postbypost’); ?> directly into it. It shows up when I do this, but wp_get_archives simply creates a text link list of the posts. I need it to have the same formatted, excerpted structure like the rest of the archives pages. ex. http://singlebarreldetroit.com/dev/wordpress/category/news/

    I still believe there must be a way to get archive.php to show a complete, unsorted, chronological post list, without having to resort to adding a new Page. Can anyone figure out how to link to this?

    Then create a Page Template and use a new query posts loop to display all your posts in excerpt form. For example:

    <?php
    $args=array(
      'post_type' => 'post',
      'post_status' => 'publish',
      'posts_per_page' => -1,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      echo 'List of Posts';
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
        <?php
      the_excerpt();
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

    Thread Starter earthtojeremy

    (@earthtojeremy)

    Michael – I did this and it just prints out the php code as text. I tried adding it to a page template in both the HTML tab and the VISUAL tab. See it here: http://singlebarreldetroit.com/single-barrel-detroit-blog-archives/

    Thread Starter earthtojeremy

    (@earthtojeremy)

    I figured out the problem. You can’t insert php directly into a new post – that is, without a plugin to parse the php code. Google “wordpress exec-php”, download and install Exec-PHP, follow MichaelH’s instructions above, and you will have the chronological listing of every blog post in your site. Edit the code to format entry listings as you wish.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Archive link to show all posts?’ is closed to new replies.