• I’ve created a template to include all recent posts and called it Full Blog.

    Then, I went and made a Page and assigned the “Full Blog” template to it, and “blog” as its post-slug.

    However, if I use The Loop in the “Full Blog” template, it simply displays the content of the Page (an empty post with a title, and that’s it) rather than all of the blog’s recent posts.

    However, if I omit the loop and code it as it is below, it works (shows all posts) but the # of comments link doesn’t show up.

    Can anyone give me any pointers?

    <?php get_header(); ?>
    <body>
    <div id="container2">
    <div id="header"><span></span></div>

    <?php include (TEMPLATEPATH . "/navbar.php"); ?>

    <div id="centerfill">
    <h1><span>Insight Blog</span></h1>

    <div id="blogcontentleft">

    <?php $posts = get_posts('numberposts=12'); foreach($posts as $post) : setup_postdata($post); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    <?php the_time('F jS, Y') ?> by <?php the_author() ?>

    <div class="entry">
    <?php the_content('Read the rest of this entry &raquo;'); ?>
    </div>

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

    </div>
    <?php endforeach; ?>
    </div>
    <div id="blogcontentright">

    <?php get_sidebar(); ?>

    </div>

    </div>
    <br class="clear">
    </div>

    <?php get_footer(); ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • A Page template is still a Page, hence anything that normally fails to appear on a Page or single post (i.e. link generated by comments_popup_link()) will still fail to do so.

    However, there is a way to *fake* WordPress out here. Add:

    $wp_query->is_page = false;

    before you start your loop, such as:

    <?php
    $wp_query->is_page = false;
    $posts =
    etc…

    If that fails to work, make sure to scope $wp_query as global:

    <?php global $wp_query;
    $wp_query->is_page = false;
    $posts =
    etc…

    Also, if you run into problems on the Page elsewhere for doing this, just insert this line after the loop has finished:

    $wp_query->is_page = true;

    Such as:

    <?php endforeach; $wp_query->is_page = true; ?>

    I still cannot get the more tags to be recognized. blog.php is still showing the entire posts. Grrr

    here is what I have in blog.php


    <div id="content">
    <?php global $wp_query;
    $wp_query->is_page = false; ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    With:

    <?php $more = ''; the_content(); ?>

    Then I have:

    <?php endif; $wp_query->is_page = true; ?>

    more tags still ignored.

    For more perspective, this is my blog.php

    [code removed - use https://wordpress.pastebin.ca ]

    OK here is the link to the Pastebin

    https://wordpress.pastebin.ca/294083

    So now what is the next step? Will the solution be found here or there? I have never used pastebin before.

    I am trying to determine why the blog.php is breaking the more tags in my posts.

    If you go to https://totalphysiqueonline.com/blog/ you will see what I am talking about.

    This matter is still unresolved

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Page/Archive template that includes all recent posts?’ is closed to new replies.