php - wordpress pagination url first page -


i using paginate_links on website.

when clicked number 2 url chage mywebsite.com /page/2. cicled pagination page number 1 , site url show mywebsite.com /page/1. want remove /page/1 on home page firs page.

this issue home page.category page working good.

ex : <<prev | 1 | 2 | next >>

anyone can me ?

paginate_links( array(         'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),         'format' => '/page/%#%',         'current' => max( 1, get_query_var('paged') ),         'total' => $wp_query->max_num_pages,         'prev_next' => true,         'prev_text'    => __('prev page'),         'next_text'    => __('next page'),         'type'  => 'array'     ) ); 

if yoursite.com/page/1 , yoursite.com same, why don't use jquery change href attribute of pagination links?

$(".pagination a:first").attr("href", "http://example.com/"); 

this code changes url of pagination's first link.

edit: change site's prev link's href attribute. won't if user on page 3, or whatever.

try this:

if($('.pagination a:first').attr('href') === "http://example.com/page/1") {     // page 2.     $(".pagination a:first").attr("href", "http://example.com/"); }     $(".pagination a:nth-child(2)").attr("href", "http://example.com/"); 

fiddle


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -