Viewing 4 replies - 1 through 4 (of 4 total)
  • I found this works in my WP 3.0 theme (not twenty ten, but similar, so YMMV):

    In functions.php, find the section referring to the page_navi: in my theme, function page_navi.

    Locate at the bottom of that paragraph of code

    $prev_link = get_previous_posts_link(__('Newer Entries »', THEME_NS));
            $next_link = get_next_posts_link(__('« Older Entries', THEME_NS));

    Comment that out and add instead
    if(function_exists('wp_pagenavi')) { wp_pagenavi(); }

    So, altogether in my theme it looks like:

    function art_page_navi($title = '', $comment = false) {
        $prev_link = null;
        $next_link = null;
        if($comment){
            $prev_link = get_previous_comments_link(__('Newer Entries »', THEME_NS));
            $next_link = get_next_comments_link(__('« Older Entries', THEME_NS));
        } elseif (is_single() || is_page()) {
            $next_link = get_previous_post_link('« %link');
            $prev_link = get_next_post_link('%link »');
        } else {
            if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
    		/*$prev_link = get_previous_posts_link(__('Newer Entries »', THEME_NS));
            $next_link = get_next_posts_link(__('« Older Entries', THEME_NS));*/
        }

    HTH. I’m not much of a coder, but it works for me (needs styling, though).

    Step1:Activate WP-PageNavi
    Step2: find the following code in your loop.php

    <?php /* Display navigation to next/previous pages when applicable */ ?>

    Step3:
    =============DELETE Star=============

    <?php if ( $wp_query->max_num_pages > 1 ) : ?>
    <div id=”nav-above” class=”navigation”>
    <div class=”nav-previous”><?php next_posts_link( __( ‘<span class=”meta-nav”>←</span> Older posts’, ‘twentyten’ ) ); ?></div>
    <div class=”nav-next”><?php previous_posts_link( __( ‘Newer posts <span class=”meta-nav”>→</span>’, ‘twentyten’ ) ); ?></div>
    </div><!– #nav-above –>
    <?php endif; ?>

    =============DELETE END==============

    Step4:
    Add

    <?php wp_pagenavi(); ?>

    instead of the DELETED code in Step3,Then update loop.php.Finished!!!

    PS:It has 2 places to change In loop.php, if all changed , one PageNavi button will display in top of the page and an other PageNavi Button will display in bottom of the page.

    My personal blog https://hh.0745666.com was in trouble like yours, and now, works fine!

    Hope can help you ??

    Thread Starter cascd88

    (@cascd88)

    thanks acefav! its really help! ??
    i just change the lowest code.. =D

    hi acefav and cascd88,
    i did this in my theme however it didn’t work… perhaps because I’m using custom post types?

    there is no other place i need to put the code so it appears in a custom post type?

    any help would be greatly appreciated! thnx

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP-PageNavi] Where to put this code in twenty ten themes?’ is closed to new replies.