• Resolved Wumakudu

    (@wumakudu)


    Hello,
    i’ve got a little question. I figured out how to change normal navigation with WP-PageNavi, but i want to display it at the bottom (like now) and at the top too ?? (I’m using it only with categorys btw., but what’s the difference)

    Any ideas?

Viewing 8 replies - 1 through 8 (of 8 total)
  • A link to your site would help.

    Also, what do you mean by “the top”? Above the logo? Above the post title? Above the content?

    I’m not familiar with WP-PageNavi (though I know it has a very good reputation). Are you simply looking for a Customizr hook to hang code that you already have?

    Thread Starter Wumakudu

    (@wumakudu)

    I mean, i’ve blocked navigation on single posts, i just have navigation on categories posts list, and i wanted to have extra navigation below maybe category title? (or somewhere there)

    Something like that:

    Category: blablabla
    <pagination/navigation>

    posts list..
    ……
    …..
    …..

    <navigation> (like now)

    OK, save me some time by telling me how you added it at the bottom. That’ll give me a clue on how to add it at the top.

    Thread Starter Wumakudu

    (@wumakudu)

    At the bottom it was normal Customizr funtion next prevorious, i jus changed it to the WP-Pagenavi, i think we can add extra navigation at the top by adding next prevorious buttons at the top, they will change automatically into WP page navi i think:) Thanks You for help one more time!

    …i jus changed it to the WP-Pagenavi..

    How? You modified core Customizr code? Or you did it with a function?

    Thread Starter Wumakudu

    (@wumakudu)

    Normally i had next prevorious navigation like always on Customizr.

    with this code:

    add_action(‘wp_head’, ‘my_post_nav’);
    function my_post_nav(){
    if ( !function_exists(‘wp_pagenavi’) )
    return;
    remove_action( ‘__after_loop’ , array( TC_post_navigation::$instance , ‘tc_post_nav’ ), 20 );
    add_action( ‘__after_loop’, ‘wp_pagenavi’, 20 );
    }

    i’ve changed next/prev navigation to WP-Pagenavi ??

    and now i just want to display navigation under the Category Title too.

    (i think You can just somehow display another navigation next/prev under the category title, and it automatically will change into the WP-Pagenavi?)

    regards

    OK. Looking at the code above, it:

    – Adds the function my_post_nav high up in the page processing (in “wp_head”);
    – Checks if WP-Page-Navi is installed and exits if it’s not;
    – Removes Customizr’s navigation from after the “loop” (which is the “thing” in WordPress that churns out posts (either lots of them, or one of them);
    – Adds WP-PageNavi’s navigation after the “loop” (which is after all the posts have been churned out; at the bottom of the page).

    So by my reckoning, if you want to add WP-PageNavi to the top of the category page as well, you can simply add it again in the code above. You only want it on the category pages, so you need to check that you are not on a single post/page and that you are in a category list. So in the end, the code you posted above should be changed to:

    add_action('wp_head', 'my_post_nav');
    function my_post_nav(){
    	if ( !function_exists('wp_pagenavi') ) {
    		return;
    	}
    
    	remove_action( '__after_loop' , array( TC_post_navigation::$instance , 'tc_post_nav' ), 20 );
    
    	add_action( '__after_loop', 'wp_pagenavi', 20 );
    
    	if ( ! is_singular() && is_category() ) {
    
    		add_action( '__after_archive_title', 'wp_pagenavi', 20 );
    
    	}
    }

    I haven’t tested this, so be prepared for it to break on a syntax error. Let us know what happens.

    p.s. When you paste code, use backticks, or the “code” button next to the b-quote button.

    Thread Starter Wumakudu

    (@wumakudu)

    @electricfeet
    You saved me again! It works exactly how i wanted to!!!
    I should buy you a beer!

    Thanks one more time, topic resolved (again thanks to you)

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to display extra post navigation at the top?’ is closed to new replies.