Support » Fixing WordPress » previous_post_link and next_post_link only on individual post

  • runtimeerror


    Hi! 🙂
    I own this website, (only +18)
    and I have previous_post_link and next_post_link template tags, but they are shown in the homepage and individual posts. How can I do that they only show in individual posts? (not in homepage).
    There’s no single.php file in the theme, so I don’t know how to make it…
    Any help? Thanks in advance! 🙂
    This is the code of index.php:

    <?php get_header(); ?>
      <div id="bd" class="yui-navset">
        <div id="yui-main">
    		<div class="yui-b" >
    			<div class="yui-ge"><div class="yui-u first">
    	<?php if (have_posts()) : ?>
    		<?php while (have_posts()) : the_post(); ?>
    <!-- item -->
    				<div class="item entry" id="post-<?php the_ID(); ?>">
    				          <div class="itemhead">
    				            <h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    				            <div class="chronodata"><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></div>
    						  <div class="storycontent">
    								<?php the_content('Read more »'); ?>
    				          <small class="metadata">
    			<span class="category">Archivado en: <?php the_category(', ') ?> <? if(!is_single()) echo "|"; ?> <?php edit_post_link('Edit', '', ' | '); ?> <font face="arial"><font size="3"><b><?php comments_popup_link('¡Comenta!', '¡1 Comentario!', '¡% Comentarios!'); ?></span></b></font></font>
    <IMG SRC="">
    <?php if ( function_exists('wp_tag_cloud') ) : ?>
    							 <?php the_tags('<span class="tags">Etiquetas: ', ', ' , '</span>'); ?>
    <iframe src="<?php echo urlencode(get_permalink($post->ID)); ?>&layout=standard&show_faces=false&width=500&action=like&colorscheme=dark" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; padding-top:2px; overflow:hidden; width:650px; height:25px"></iframe>
    							 <?php endif; ?><br>
    <b><?php previous_post_link(); ?></b>
    <span style="float:right"><b><?php next_post_link(); ?></b></span>
    <!-- end item -->
    <?php comments_template(); // Get wp-comments.php template ?>
    		<?php endwhile; ?>
    		<div class="navigation">
                            <b><font face= arial><font size=4>
    			<div class="alignleft"><?php next_posts_link('« Cómics anteriores') ?></div>
    			<div class="alignright"><?php previous_posts_link('Cómics siguientes »') ?></div>
    	<?php else : ?>
    		<h2 class="center">¡Joder, no se encuentra la página!</h2>
    		<p class="center">Lo siento, lo que buscas no está aquí. Sigue buscando xD!</p>
    	<?php endif; ?>
    <!-- end content -->
    <!-- 2nd sidebar -->
    </div><!-- end yiu-u --><div class="yui-u" id="third"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('rightsidebar') ) : ?><h4>Extra Column</h4><p>You can fill this column by editing the index.php theme file. Or by Widget support.</p><?php endif; ?></div>
    <!-- end 2nd sidebar -->
    	<div class="yui-b" id="secondary">
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • vtxyzzy


    I can’t test this, but I think you can remove these two lines:

    <b><?php previous_post_link(); ?></b>
    <span style="float:right"><b><?php next_post_link(); ?></b></span>


Viewing 1 replies (of 1 total)
  • The topic ‘previous_post_link and next_post_link only on individual post’ is closed to new replies.