• Hello guys!

    wp-navi works ok with my custom post type in every page except the front (index.php) page.

    Actually it seems like wp-navi have a problem with my current query structure.

    if i type:
    https://www.mypage.com/page/2/
    wp-navi returns 404!

    But if i try: https://www.mypace/eshop/page/2
    Works ok!

    Note that “eshop” is my custom post type which i loop in the front page..

    So is there a way to make it query “/eshop/page/2” (which works great) instead of “mypage.com/page/2” ??

    Here is the code of my index.php:

    global $post;
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $args = array( 'post_type' => 'eshop', 'posts_per_page' => 8,'paged' => $paged);
    
    $loop = new WP_Query( $args );
    if($loop->have_posts()) : while ( $loop->have_posts() ) : $loop->the_post();

    and my wp-navi code:

    <?php wp_pagenavi( array( 'query' =>$loop )); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • shawn

    (@shawnsandycom)

    Had the same problem use $page instead of $paged on the static front pages here a simple example..

    if(is_front_page() ):
        $paged = (get_query_var('page')) ? get_query_var('page') : 1;
        else  :
        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
        endif;
    Thread Starter everfrost

    (@everfrost)

    unfortunately this didn’t work!
    There must be a way to query /eshop/page/x (which works) instead of domain.com/page/x

    a simple cheat from me ??
    create new page template (e.g. home) , then copy paste your index.php codes into the new page template. after you done with the page template, set the reading on settings for the Front page displays into a static page then choose home for display at the front of page ??
    it work for me ??

    you can use that trick during the team go for fix it ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp-navi works great everywhere except the front(index.php) page!’ is closed to new replies.