Remove one of the navigation block: prev link / next link


Author Message
Jean

Posted: 4/20/2009
Quote message 

Hello,
I would like to remove one of the navigation block, the upper (prev_link | next_link). Here is the code file single.php. What lines should I delete to not display the navigation block above?
Thank you in advance.

<?php get_header(); ?>

<div class="contentLayout">
<div class="content">

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$prev_link = get_previous_post_link('&laquo; %link');
$next_link = get_next_post_link('%link &raquo;');
?>
<?php if ($prev_link || $next_link): ?>
<div class="Post">
<div class="Post-tl"></div>
<div class="Post-tr"></div>
<div class="Post-bl"></div>
<div class="Post-br"></div>
<div class="Post-tc"></div>
<div class="Post-bc"></div>
<div class="Post-cl"></div>
<div class="Post-cr"></div>
<div class="Post-cc"></div>
<div class="Post-body">
<div class="Post-inner article">

<div class="PostContent">

<div class="navigation">
<div class="alignleft"><?php echo $prev_link; ?></div>
<div class="alignright"><?php echo $next_link; ?></div>
</div>

</div>
<div class="cleared"></div>


</div>

</div>
</div>

<?php endif; ?>
<div class="Post">
<div class="Post-tl"></div>
<div class="Post-tr"></div>
<div class="Post-bl"></div>
<div class="Post-br"></div>
<div class="Post-tc"></div>
<div class="Post-bc"></div>
<div class="Post-cl"></div>
<div class="Post-cr"></div>
<div class="Post-cc"></div>
<div class="Post-body">
<div class="Post-inner article">
<h2 class="PostHeaderIcon-wrapper">
<span class="PostHeader"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>">
<?php the_title(); ?>
</a></span>
</h2>
<div class="PostContent">
<?php if (is_search()) the_excerpt(); else the_content(__('Read the rest of this entry &raquo;', 'kubrick')); ?>

</div>
<div class="cleared"></div>
<?php ob_start(); ?>
<?php $icons = array(); ?>
<?php if (!is_page()) : ?>
<?php ob_start(); ?>
<img src="<?php bloginfo('template_url'); ?>/images/PostCategoryIcon.png" width="18" height="18" alt="PostCategoryIcon" />
<?php printf(__('Posted in %s', 'kubrick'), get_the_category_list(', ')); ?>
<?php $icons[] = ob_get_clean(); ?>
<?php endif; ?>
<?php if (0 != count($icons)): ?>
<div class="PostFooterIcons metadata-icons">
<?php echo implode(' | ', $icons); ?>

</div>
<?php endif; ?>
<?php $metadataContent = ob_get_clean(); ?>
<?php if (trim($metadataContent) != ''): ?>
<div class="PostMetadataFooter">
<?php echo $metadataContent; ?>

</div>
<?php endif; ?>

</div>

</div>
</div>

<?php if ($prev_link || $next_link): ?>
<div class="Post">
<div class="Post-tl"></div>
<div class="Post-tr"></div>
<div class="Post-bl"></div>
<div class="Post-br"></div>
<div class="Post-tc"></div>
<div class="Post-bc"></div>
<div class="Post-cl"></div>
<div class="Post-cr"></div>
<div class="Post-cc"></div>
<div class="Post-body">
<div class="Post-inner article">

<div class="PostContent">

<div class="navigation">
<div class="alignleft"><?php echo $prev_link; ?></div>
<div class="alignright"><?php echo $next_link; ?></div>
</div>

</div>
<div class="cleared"></div>


</div>

</div>
</div>

<?php endif; ?>
<?php comments_template(); ?>
<?php endwhile; ?>
<?php else: ?>
<p><?php _e('Sorry, no posts matched your criteria.', 'kubrick'); ?></p>
<?php endif; ?>

</div>
<div class="sidebar1">
<?php include (TEMPLATEPATH . '/sidebar1.php'); ?>
</div>

</div>
<div class="cleared"></div>

<?php get_footer(); ?>/code]
 
Bob

Posted: 4/20/2009
Quote message 

This little part not too far from the top....


<div class="PostContent">

<div class="navigation">
<div class="alignleft"><?php echo $prev_link; ?></div>
<div class="alignright"><?php echo $next_link; ?></div>
</div>
</div>
<div class="cleared"></div>
 
Jean

Posted: 4/20/2009
Quote message 

Thank you Bob. That's what I tried yesterday but it remains empty block above post ... We have to remove a few lines for remove completely the useless block . What lines please ?


 
Jean

Posted: 4/21/2009
Quote message 

I found the solution: this is the code of the single.php page without the navigation at the top

<?php get_header(); ?>

<div class="contentLayout">
<div class="content">

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$prev_link = get_previous_post_link('&laquo; %link');
$next_link = get_next_post_link('%link &raquo;');
?>
<?php if ($prev_link || $next_link): ?>
<?php endif; ?>
<div class="Post">
<div class="Post-tl"></div>
<div class="Post-tr"></div>
<div class="Post-bl"></div>
<div class="Post-br"></div>
<div class="Post-tc"></div>
<div class="Post-bc"></div>
<div class="Post-cl"></div>
<div class="Post-cr"></div>
<div class="Post-cc"></div>
<div class="Post-body">
<div class="Post-inner article">
<h2 class="PostHeaderIcon-wrapper">
<span class="PostHeader"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>">
<?php the_title(); ?>
</a></span>
</h2>
<div class="PostContent">
<?php if (is_search()) the_excerpt(); else the_content(__('Read the rest of this entry &raquo;', 'kubrick')); ?>

</div>
<div class="cleared"></div>
<?php ob_start(); ?>
<?php $icons = array(); ?>
<?php if (!is_page()) : ?>
<?php ob_start(); ?>
<img src="<?php bloginfo('template_url'); ?>/images/PostCategoryIcon.png" width="18" height="18" alt="PostCategoryIcon" />
<?php printf(__('Posted in %s', 'kubrick'), get_the_category_list(', ')); ?>
<?php $icons[] = ob_get_clean(); ?>
<?php endif; ?>
<?php if (0 != count($icons)): ?>
<div class="PostFooterIcons metadata-icons">
<?php echo implode(' | ', $icons); ?>

</div>
<?php endif; ?>
<?php $metadataContent = ob_get_clean(); ?>
<?php if (trim($metadataContent) != ''): ?>
<div class="PostMetadataFooter">
<?php echo $metadataContent; ?>

</div>
<?php endif; ?>

</div>

</div>
</div>

<?php if ($prev_link || $next_link): ?>
<div class="Post">
<div class="Post-tl"></div>
<div class="Post-tr"></div>
<div class="Post-bl"></div>
<div class="Post-br"></div>
<div class="Post-tc"></div>
<div class="Post-bc"></div>
<div class="Post-cl"></div>
<div class="Post-cr"></div>
<div class="Post-cc"></div>
<div class="Post-body">
<div class="Post-inner article">

<div class="PostContent">

<div class="navigation">
<div class="alignleft"><?php echo $prev_link; ?></div>
<div class="alignright"><?php echo $next_link; ?></div>
</div>

</div>
<div class="cleared"></div>


</div>

</div>
</div>

<?php endif; ?>
<?php comments_template(); ?>
<?php endwhile; ?>
<?php else: ?>
<p><?php _e('Sorry, no posts matched your criteria.', 'kubrick'); ?></p>
<?php endif; ?>

</div>
<div class="sidebar1">
<?php include (TEMPLATEPATH . '/sidebar1.php'); ?>
</div>

</div>
<div class="cleared"></div>

<?php get_footer(); ?>

 
Bob

Posted: 4/21/2009
Quote message 

Okay so it looks like you had to take out all the <div> tags that come right before the navigation block. My theme was pretty plain and taking out just the code worked. I'll go back to mine and see about the other <div> tags.
 
Luis

Posted: 11/12/2009
Quote message 

Quote Bob:

Okay so it looks like you had to take out all the <div> tags that come right before the navigation block. My theme was pretty plain and taking out just the code worked. I'll go back to mine and see about the other <div> tags.


Thanks Bob! That was really helpful and saved me a lot of time playing with the php!
 

Reply


NAME *
EMAIL
SMILIES :-) :( :-D 8-) :*) :-/ :-{} :-X :-O :-@ O:) :-P :-< :-( :-| ;-) 
CODES [Quote] [B] [I] [U] [Code] [IMG] 
BODY *  
VALIDATION *