WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
wp-navi works great everywhere except the front(index.php) page! (4 posts)

  1. everfrost
    Member
    Posted 1 year ago #

    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:
    http://www.mypage.com/page/2/
    wp-navi returns 404!

    But if i try: http://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 )); ?>

  2. shawn
    Member
    Posted 1 year ago #

    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;
  3. everfrost
    Member
    Posted 1 year ago #

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

  4. karjogedhe
    Member
    Posted 1 year ago #

    a simple cheat from me :D
    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 :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.