Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author PenciDesign

    (@bboy8k)

    Hi,

    You can see example here:

    = With default query =

    <?php
    if(have_posts()):
    while(have_posts()): the_post();
    // Template loop here
    endwhile;
    echo easy_wp_pagenavigation();
    else:
    // No result
    endif; wp_reset_query();
    ?>

    = With custom query =

    <?php
    // You need protect against arbitrary paged values
    $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
    
    $args = array(
        'post_type' => 'post',
        'posts_per_page' => 6,
        'paged' => $paged,
    );
    
    $my_query = new WP_Query( $args );
    
    if($my_query->have_posts()):
    while($my_query->have_posts()): $my_query->the_post();
    // Template loop here
    endwhile;
    echo easy_wp_pagenavigation( $my_query );
    else:
    // No result
    endif; wp_reset_postdata();
    ?>

    It’s easy to use 🙂

    Thread Starter hajde.de

    (@hajdede)

    It is easy for you, not for me 🙂
    I am not a programmer, i do not where I put this code.

    Plugin Author PenciDesign

    (@bboy8k)

    You can’t add page navigation if you don’t add this code to your themes.
    Because, wordpress not provide hook for add this to querys in theme, also in your themes, I don’t know query you use in templates.
    So it’s imperative 🙂

    Can we filter by category with Easy WP Page Navigation?

    I need a way to page posts from just 1 category, not all posts… 🙁

    Can we filter by several categories too?

    Something like:

    $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
    
    $args = array(
        'post_type' => 'post',
        'posts_per_page' => 10,
        'cat' => 21,
        'paged' => $paged,
    );
    
    $my_query = new WP_Query( $args );

    will work?

    EDIT: it does! 😀 \o/
    You should add https://codex.ww.wp.xz.cn/Class_Reference/WP_Query to the faq, or install section…

    Plugin Author PenciDesign

    (@bboy8k)

    @luuuciano it’ll work 😉
    I’m glad for it work with you 😉

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘More information about installing’ is closed to new replies.