Forums

How-to display author bio on ONLY last page (3 posts)

  1. idevgames
    Member
    Posted 2 years ago #

    Hello, In my template, I have this code:

    <?php
    if (in_category(8)|in_category(9)|in_category(10)|in_category(11)|in_category(12)|in_category(14)|in_category(18))
    {
         echo '<br /><h6><em>About the author</em></h6>';
         echo '<em style="font-size:85%;">';
         echo the_author_description();
         echo '</em>';
     }    
    
    ?>

    For my single posts that are multi-page, how do I edit the above so that it ONLY shows the author's bio on the very last page? It is showing on each page now.

    Thanks,
    Carlos

  2. RockyMtnHi
    Member
    Posted 2 years ago #

    You might try something like this. This is my stripped down loop. The 2 lines of interest to you deal with the variable $numPosts.

    <?php if (have_posts()) : ?>
    <br />
    		<?php while (have_posts()) : the_post();
    <strong>		$numPosts = $numPosts + 1; ?></strong>
    <?php
    <strong>if($numPosts == 9) {</strong>
    the_excerpt(); ?><span class="read_more"><a href="<?php the_permalink(); ?>">Read More >></a></span> <?php
     } else {
    	the_content('Read the rest of this entry >>');
     } ?>
    				<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    			</div>
    			<p></p>
    		<?php endwhile; ?>
    <?php endif; ?>
  3. idevgames
    Member
    Posted 2 years ago #

    In your code, you are increasing the counter. And when it reaches 9, you are doing something. Ideally, the line would say...

    If the counter has reached the last page, display/do whatever.

    Someone should make a plugin.
    lol

Topic Closed

This topic has been closed to new replies.

About this Topic