• Resolved Jeff Milone

    (@raid33)


    I have a page template for a “Blog Page” that basically just provides a paged listing of the 5 latest posts. The issue: the posts are displayed in-full, and are ignoring the “more” tag I placed in them. How can I make the “more” tag be utilized? Here is the code for that page:

    <?php
    /*
    Template Name: Blog Page
    */
    ?>
    
    <?php get_header(); ?>
    
    <div id="content">
    
       <div id="contentleft">
    
          <div class="postarea">   
    
             <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("showposts=5&paged=$page"); while ( have_posts() ) : the_post() ?>
             <h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    
             <div class="date">
                <p><?php the_time('F j, Y'); ?></p>
             </div>
    
             <?php the_content(__('[Read more]'));?><div style="clear:both;"></div>
    
             <div class="postmeta2">
                <p>Filed Under <?php the_category(', ') ?> &middot; <?php comments_popup_link('Leave a Comment', '1 Comment', '% Comments'); ?> &nbsp;<?php edit_post_link('(Edit)', '', ''); ?></p>
             </div>
    
             <?php endwhile; ?>
    
             <p><?php posts_nav_link(); ?></p>   
    
          </div>
    
       </div>
    
    <?php include(TEMPLATEPATH."/sidebar_post.php");?>
    
    </div>
    
    <!-- The main column ends  -->
    
    <?php get_footer(); ?>
Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter Jeff Milone

    (@raid33)

    Any ideas on this? I can’t quite figure it out.

    Nobody can read long code here…
    use a pastebin like http://wordpress.pastebin.ca

    If you don’t mess with the Loop – it should work.

    I have a similar problem. On page.php, after the loop I’m using get_posts to grab and display some Posts that are related to the current Page.

    Everything is fine except that I’m getting full content without the more link. Does the more quicktag not work with get_posts on page.php?

    global $post; $myposts = get_posts('numberposts=99&category='.$relatedcat.'&order=ASC');
    	 if($myposts) {
    	 foreach($myposts as $post) {
    	 setup_postdata($post);

    and then…

    the_content("Continue reading " . the_title('', '', false));

    The full code of page.php is at http://wordpress.pastebin.ca/1022004.

    the “more…” does NOT work on Pages by default – a Page displays just one single entry, so no need for it: there is no “multi-Page” view in WP.

    According to some older posts in this forum that you could find by searching – this should address the issue:
    <?php $more = 0; ?> if placed before the query.

    I always search before posting, which is how I ended up in this thread. It was the closest thing I could find to my issue after digging around. I’m sure it’s been discussed before and I’m sorry for the repeat. I’m a new member of the WP community and just looking for a little help from the support forum.

    Thanks for the information about changing the setting. It’s incredibly helpful for using a Page more flexibly.

    After much experimentation, here is what I’ve learned:

    The more quicktag does not seem to work with get_posts() outside the loop even when using $more = 0; or a custom template instead of page.php.

    The more quicktag will work with query_posts() outside the loop if you set $more = 0; even if you use page.php.

    A note for people switching functions. Use category= with get_posts(). Use cat= with query_posts().

    Next challenge: get tags working on my related posts displayed below a page’s content.

    Here’s my query for posterity:

    <?php if (isset ($relatedcat)) { // related cat set in custom field
     $query= 'numberposts=99&cat='. $relatedcat.'&orderby=date&order=ASC';
     query_posts($query); // run the query
     global $more; $more = 0; // allow more quicktag
     while (have_posts()) : the_post(); // the loop
     setup_postdata($post);
    ?>
    <div class="post" >

    I have a custom template being used as the home page, which is using query_posts and get_posts* throughout the page, and I too could not get More to work.

    However, after adding “$more = 0” above my query_posts call, it worked fine.

    * I’m annoyed that I can’t exclude categories from get_posts. I’m also annoyed that the default behavior of query_posts is to ignore the More tag when showposts=1 …

    Correction – query_posts will obey the More tag, even if you specify it to only show one Post.

    I read “The <!–more–> quicktag will not operate and is ignored if there is only one post being displayed. ” in the_content page.

    I have the exact same problem. I’m new to WordPress as well and it seems that no one had a clear answer to this problem. It seems to me that there may be an easier way to do what I’m trying to do.
    Here is my setup:
    -It’s basically the front page of my website.
    -I want to post a new article on the mainpage which viewer can add comments to. I’d be updating this article about once a week.
    -I want only a few paragraphs to show up on the mainpage, hence the need for the MORE TAG.
    -I had this working with the query_posts function set to ‘posts_per_page’ and it was working fine.
    -The problem came when I passed the parameter ‘name=article’. It did it’s job by posting the specific post I wanted. However, it posted the entire artcle, ruining my design objective.

    moshu’s solution works perfectly for me. Just add:

    <?php $more = 0; ?>

    before the query.

    The point of a blog page isn’t to give full content anyways and you would be much better off using excerpt or content_limit (with the limit content plugin) If you really want to make an SEO impact you will use the excerpt option and handcraft your excerpts making good use of keywords.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Posts on Blog Page not utilizing “More” tags’ is closed to new replies.