Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

http://i.stack.imgur.com/Yr35p.jpg

As you can see in the picture above. I got two links for each page. I'm using <div class="pagelink"><?php wp_link_pages('pagelink=Source %'); ?></div> for the top one and the bottom one is automatically appearing because of <!--nextpage-->

So how do I remove the links in the bottom. If I remove <!--nextpage--> the top one will dissapear as well.

Thanks.

Edit: My single.php

<?php get_header(); ?>

    <div id="content_box">

        <div id="left_box">

            <div id="content">

                <div id="content_inner">
<?php 
                if (have_posts()) : 
                    while (have_posts()) : the_post(); ?>

                    <h1><?php the_title(); ?></h1>
                    <p class="post_author"><em>by</em> <?php the_author(); ?></p>
<div class="pagelink"><?php wp_link_pages('pagelink=Source %'); ?></div>
                    <div class="format_text">
<?php the_content('<p>Read the rest of this entry &raquo;</p>'); ?>
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
                    </div>

                </div>

                <?php comments_template(); ?>
<?php 
                    endwhile;
                else: ?>

                    <h1>Uh oh.</h1>
                    <div class="format_text">
                        <p>Sorry, no posts matched your criteria. Wanna search instead?</p>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
                    </div>

                </div>
<?php 
                endif; ?>

            </div>

            <?php include (TEMPLATEPATH . '/left_bar.php')?>

        </div>

        <?php get_sidebar(); ?>

    </div>

<?php get_footer(); ?>

My theme is: Neoclassical

share|improve this question
    
Do you use your PHP code in manually in posts, or you edited single.php file? –  Mamaduka Aug 22 '11 at 8:32
    
@Mamaduka I put this in <div class="pagelink"><?php wp_link_pages('pagelink=Source %'); ?></div> in my single.php –  Muazam Aug 22 '11 at 8:33
    
can you paste your single.php code or tell what theme you're using? –  Mamaduka Aug 22 '11 at 8:37
    
@Mamaduka Added in first post. –  Muazam Aug 22 '11 at 8:41

1 Answer 1

up vote 0 down vote accepted

Your theme is using old and deprecated function link_pages to display page-links for paginated posts.

Just replace this chunk of code:

<div class="pagelink"><?php wp_link_pages('pagelink=Source %'); ?></div>
                    <div class="format_text">
<?php the_content('<p>Read the rest of this entry &raquo;</p>'); ?>
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
                    </div>

with this:

                    <div class="format_text">
<?php the_content('<p>Read the rest of this entry &raquo;</p>'); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">Pages:', 'after' => '</div>', 'pagelink' => 'Source %' ) ); ?>
                    </div>
share|improve this answer
    
I commented link_pages and it works as I wanted it to. What does you code do? Should I change it to yours? And thanks a lot! btw, checked out your homepage, very similar to my name :P –  Muazam Aug 22 '11 at 8:59
    
Remove link_pages you don't need that old deprecated function anymore, my code shows how you should use wp_link_pages. yes it similar but meaning is different –  Mamaduka Aug 22 '11 at 9:01
    
I see, Thank you. Now I can move on and finish my site :) And I see that you put my div inside the fuction, pretty smart! –  Muazam Aug 22 '11 at 9:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.