WordPress.org

Ready to get started?Download WordPress

Forums

Magazine Basic
can't find 'wp_link_pages() function' in magazine basic (6 posts)

  1. legaltranz
    Member
    Posted 1 year ago #

    numerous attempts, but just can't change the pagination to be looking like this: 'previous page' 'next page', instead of the current pagination showing all pages numbers like: Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13….

    I tried many codes on the internet to accomplish this, and installed the plug-in wp-navi,but all failed.

    could anyone show me the way how to do it in the theme of magazine basic?

    http://wordpress.org/extend/themes/magazine-basic/

  2. legaltranz
    Member
    Posted 1 year ago #

    single.php:

    <?php
    /**
     * The Template for displaying all single posts.
     *
     * @since 3.0.0
     */
    get_header(); ?>
    
    	<div id="primary" <?php mb_primary_attr(); ?> role="main">
    		<?php while ( have_posts() ) : the_post();
    	    	global $mb_content_area;
    	    	$mb_content_area = 'main';
    	    	get_template_part( 'content', get_post_format() );
    	    	?>
    
    			<div id="posts-pagination">
    				<h3 class="assistive-text"><?php _e( 'Post navigation', 'magazine-basic' ); ?></h3>
    				<div class="previous fl"><?php previous_post_link( '%link', __( '<span class="meta-nav">←</span> %title', 'magazine-basic' ) ); ?></div>
    				<div class="next fr"><?php next_post_link( '%link', __( '%title <span class="meta-nav">→</span>', 'magazine-basic' ) ); ?></div>
    			</div><!-- #posts-pagination -->
    
    			<?php
    			if ( 'attachment' != get_post_type( get_the_ID() ) )
    			     comments_template( '', true );
    			?>
    
    		<?php endwhile; // end of the loop. ?>
    	</div><!-- #primary.c8 -->
    
    <?php get_footer(); ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

  3. bcworkz
    Member
    Posted 1 year ago #

    First of all, deactivate wp_pagenavi, that is what is generating the 12345 links. Then, on your theme's index.php, replace either wp_pagenavi(); and/or mb_pagination(); (line 75 in the default distribution) or anything else you placed that is generating pagination links, with the following:

    next_posts_link('next page');
    previous_posts_link('previous page');

    Ensure the code is wrapped in a <?php ?> block. You'll probably need to add styling to get the links to appear where you want.

  4. legaltranz
    Member
    Posted 1 year ago #

    thanks for the help, I deactivated wp_pagenavi, and after replacing either wp_pagenavi(); and/or mb_pagination(); with

    next_posts_link('next page');
    previous_posts_link('previous page');

    I get this:
    <img src="http://image142-c.poco.cn/mypoco/myphoto/20130508/06/63788011201305080656372625971814562_001.jpg" />

    Actually, my problem is that in a long single post (not the index page), I used the <!--nextpage--> quicktag to divide it into multiple pages, and the pagination looks like this:

    <img src="http://image142-c.poco.cn/mypoco/myphoto/20130508/06/63788011201305080656372625971814562_000.jpg">

    Can I have "Next Previous" links, instead of 12345 links, on the single post page?

  5. keesiemeijer
    moderator
    Posted 1 year ago #

    Try it with next_post_link() and previous_post_link() (without the 's' ):
    http://codex.wordpress.org/Function_Reference/next_post_link
    http://codex.wordpress.org/Template_Tags/previous_post_link

    Use the functions after: <?php endwhile; // end of the loop. ?>

    If you want to show pagenumbers or text for a post that is divided by '<!--nextpage-->' you can use wp_link_pages() inside the loop (before the endwhile):
    http://codex.wordpress.org/Template_Tags/wp_link_pages
    Example to show text instead of numbers:

    <?php
    $args = array(
    	'next_or_number'   => 'next',
    	'nextpagelink'     => __( 'Next page' ),
    	'previouspagelink' => __( 'Previous page' ),
    );
    wp_link_pages( $args );
    ?>
  6. c.bavota
    Member
    Theme Author

    Posted 1 year ago #

    Open up content-footer.php and you will find wp_link_pages(). The issue you are encountering is due to the fact that your posts are split up into too many sub-pages. Both nav function suggested above are to go to the next or previous post. The only function that exists to switch pages within a single post is wp_link_pages().

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic