Support » Theme: AlbinoMouse » next_posts_link() and previous_posts_link()

  • Resolved Dager

    (@dager)


    Hello,

    I am trying to use WP-PageNavi, but I cannot locate the calls for next_posts_link() and previous_posts_link() . Where would these be located?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Theme Author Stefan Brechbuehl

    (@pixelstrolch)

    Hi Dager,

    these are located in the albinomouse_content_nav function in inc > template-tags.php.

    Pixelstrolch,

    The code is different from the default wordpress. How would I go about integrating the two codes below to get WP-PageNavi to work in the template-tags.php?

    <?php wp_pagenavi(); ?> or
    <?php wp_pagenavi( array( ‘type’ => ‘multipart’ ) ); ?>

    Thanks for your help.

    Correct me if I’m wrong but I believe I got it. Locate the lines of codes below and delete the ones in bold. Replace “get_next_posts_link” with “wp_pagenavi”

    <?php if ( get_next_posts_link() ) : ?>
    <li class=”older-posts”><?php next_posts_link( ‘← ‘ . __( ‘Older posts’, ‘albinomouse’ )); ?>
    <?php endif; ?>

    <?php if ( get_previous_posts_link() ) : ?>
    <li class=”newer-posts”><?php previous_posts_link( __( ‘Newer posts’, ‘albinomouse’) . ‘ →</span>’ ); ?>
    <?php endif; ?>

    Theme Author Stefan Brechbuehl

    (@pixelstrolch)

    You need to delete the first part as well.

    Exchange line 43-49
    with <?php wp_pagenavi(); ?>

    However, I recommend you to use a child theme. The next update will come and your changes will be overwritten otherwise.

    Awesome, thank you for the help!

    I looked into creating a child theme. I got the style.css set up, but how would I go about getting the child theme to work so that I can modify the template-tags.php as part of the child theme?

    Theme Author Stefan Brechbuehl

    (@pixelstrolch)

    1. Create an empty php file and call it functions.php
    2. Copy the function albinomouse_content_nav() from line 13-56
    3. Customize the function how you like it

    The parent functions.php will be loaded after the child functions.php. However, it wont be overwritten because of the condition in line 9.

    More informations about child themes: https://codex.wordpress.org/Child_Themes

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘next_posts_link() and previous_posts_link()’ is closed to new replies.