WordPress.org

Ready to get started?Download WordPress

Forums

Graphene
Pagination Style Problem (5 posts)

  1. The Magpie
    Member
    Posted 1 year ago #

    Hi there! I love your theme but there is one major flaw, namely its lack of a properly styled pagination nav menu. For such an expansive and great looking theme, it is a shame. Anyway I was trying to solve this but I cannot find the next_posts_link() and previous_posts_link() functions in the loop.php file. Can you tell me where they are please?

    Oh, I'm sure that if you include some pagination options with future updates everyone using this theme is going to thank you for it. Something just as simple as applying the button style to the pagination nav menu would suffice.

    Anyway thanks for this great theme

  2. Prasanna SP
    Member
    Posted 1 year ago #

    next_posts_link() and previous_posts_link() are in /includes/theme-loop.php. You don't have to hack parent theme to change it. The function is wrapped in if (!function_exists( 'graphene_posts_nav' ) ). So, just create a function in your child theme called graphene_posts_nav() and make it your own.

    The theme natively supports WP-PageNavi plugin. Just install it and you have a flawless pagination system!

    If you want to style single posts navigation, you can target .previous and .next-post CSS classes. I've done it in my site. See here - http://www.prasannasp.net/fixed-position-graphene-theme-header-menu/

  3. The Magpie
    Member
    Posted 1 year ago #

    Thanks for your reply. PageNavi works, but what I am looking for is a way to change pagination style for multiple page posts. PageNavi only adds a decent looking navigation bar for the home page. It does nothing for posts. So I am trying to use Simple pagination instead. In the installation directions the plugin states that:

    Usage for posts
    In your theme, open the theme files where you'd like pagination to be used. You need to find calls to next_posts_link() and previous_posts_link() and replace them.

    Usually this is the loop.php file.

    You would replace those two lines with this:

    <?php if(function_exists('wp_simple_pagination')) {
    wp_simple_pagination();
    } ?>

    I am obviously no PHP wizard so my question is where do I need to replace these functions to allow for post pagination?

    The plugin author also states that " Display pagination in the loop of posts <?php wp_simple_pagination(); ?>"

    What do I do, and where do I do it?

    Thanks!

  4. Prasanna SP
    Member
    Posted 1 year ago #

    No need to edit parent theme files. Add this to child-theme's functions.php file anywhere between <?php and ?>

    function graphene_posts_nav(){
                    if (function_exists( 'wp_pagenavi' ) ) :  ?>
                            <div class="post-nav clearfix">
                                    <?php wp_pagenavi(); ?>
                            </div>
                <div class="post-nav clearfix">
                        <p class="wp-simple-pagination"><?php if(function_exists('wp_simple_pagination')) {
        wp_simple_pagination();
    } ?></p>
                </div>
    
            <?php
                    endif;
            }
  5. The Magpie
    Member
    Posted 1 year ago #

    Thanks for your reply! Unfortunately it did not work. I added a functions.php file to my child theme and added the code. This is how the entire file looks

    <?php
    function graphene_posts_nav(){
                    if (function_exists( 'wp_pagenavi' ) ) :  ?>
                            <div class="post-nav clearfix">
                                    <?php wp_pagenavi(); ?>
                            </div>
                <div class="post-nav clearfix">
                        <p class="wp-simple-pagination"><?php if(function_exists('wp_simple_pagination')) {
        wp_simple_pagination();
    } ?></p>
                </div>
    
            <?php
                    endif;
            }
    ?>

    Unfortunately there is no change. The post are still not paginated with pagenavi.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic