Forums

More tag not working in custom page template (8 posts)

  1. geezerd
    Member
    Posted 2 years ago #

    Hi, All
    Anyone out there know why when I add the More tag on this custom page that I made to display one particular category (Articles) it doesn't work?
    When I changed it to the_excerpt it showed just an excerpt, but no go with the More tag.
    Thanks in advance.

    <?php
    /*
    Template Name: Articles
    */
    ?>
    
    <?php get_header(); ?>
    <?php get_sidebar(); ?>
    <div id="content">
    
    <?php query_posts('category_name=Articles&showposts=10'); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
    <?php the_content('Continue Reading...'); ?>
    <div class="post-details"> <h3>Posted in <?php the_category(' and ',''); ?> on <?php the_time('F jS, Y') ?> at <?php the_time() ?> by <?php the_author_posts_link(); ?>. </p><a href="<?php the_permalink() ?>#comments"><?php comments_number('Add a comment','1 comment','% comments'); ?></a></h3>
    </div>
    </div>
    <?php comments_template(); ?><?php endwhile; ?><?php else : ?><div class="post" id="post-<?php the_ID(); ?>">
    <h2>Nothing to see here</h2>
    <p>You seemed to have found a mislinked file, page, or search query with zero results. If you feel that you've reached this page in error, double check the URL and or search string and try again.</p>
    <p>Alternatively, a more personalized method of tracking down and searching for content can be found <a href="#bottom_box">below</a>.</p>
    </div>
    <?php endif; ?>
    
    <div class="nextprevious">
    <div class="left"><?php next_posts_link('&laquo; Older Entries') ?></div>
    <div class="right"><?php previous_posts_link('Recent Entries &raquo;') ?></div>
    </div>
    <div class="clear"></div>
    </div>
    <?php get_footer(); ?>
  2. Shane G
    Member
    Posted 2 years ago #

    Hi,

    Refer this article:

    http://codex.wordpress.org/Customizing_the_Read_More

    Thanks,

    Shane G.

  3. geezerd
    Member
    Posted 2 years ago #

    Yah, I figured it out awhile ago. For some reason I had to use

    <?php
    global $more;
    $more = 0;
    ?>

    Dunno why, though, it's not the home (front) page.
    ?

  4. verticalhouse
    Member
    Posted 2 years ago #

    Hey geezerd--I'm having a similar problem. Where did you enter the code that you had to use?

  5. iwbyte
    Member
    Posted 1 year ago #

    @geezerd that worked for me - thanks!

    @verticalhouse in case you haven't already played with it, I just put it above where I had my call for the posts loop.

    Dunno why custom templates needed it.

  6. LudovicAoi
    Member
    Posted 1 year ago #

    Hey! Had the same problem but now I can't show the post's thumbnail!
    Anybody was able to solve this?

  7. LudovicAoi
    Member
    Posted 1 year ago #

    Ah, solved!

    <?php
    global $more;
    $more = 0;
    ?>
    
    <?php echo get_the_post_thumbnail( $id, $size, $attr ); ?> 
    
    <?php the_content('Read more...'); ?>
  8. geezerd
    Member
    Posted 1 year ago #

    On http://codex.wordpress.org/Customizing_the_Read_More
    Scroll down to: "How to use Read More in Pages" almost at the bottom.

    We're "turning on" the more tag for Pages.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags