• Hanhyoah

    (@hanhyoah)


    I use PHP Code for post to place PHP into Template . Everything work find , but Page navigation don’t show up .
    Here my simple Loop from my site , still design in local host so i can’t give you adress . But if you know how to fix it , you can comment below or maybe Teamviewer with my PC .

    <?php $lastest= new WP_Query ( array
    (
    'post_type' => post,
    'posts_per_page' => 10,
    'ignore_sticky_posts' => 1
    )
    );
    ?>
    <div id="content-wrap">
    <?php while($lastest->have_posts()) : $lastest->the_post(); ?>
    <div id="lastest-new-wrap">
    <div id="thumbnail-wrap">
    <div id="thumbnail-size"><?php the_post_thumbnail(); ?></div>
    </div>
    <h1 id="title"><a>"><?php the_title(); ?></a></h1>
    <div id="post-desc"><?php the_excerpt(); ?></div>
    </div>
    <?php endwhile; ?>
    <?php next_posts_link(); ?>
    <?php previous_posts_link(); ?>
    </div>
    <?php wp_reset_postdata(); ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • gabrielcastillo

    (@gabrielcastillo)

    Well, if you are trying to get page navigation to show in your loop, I’m not sure if that is possible? But if you are, the results will be each post will have a navbar within it. Not sure if that is the desired result.

    If you just want to get your you need to insert wp_nav_menu() function with some params, or you could use wp_page_menu()

    Here is the reference for wp_nav_menu(): wp_nav_menu

    I do this in my templates sometimes before the loop usually under my header or where needed.

    <div id="navbar">
    <?php wp_nav_menu(array('menu'=>'primary')); ?>
    </div>

    Review the codex and you will find your solution.

    Thread Starter Hanhyoah

    (@hanhyoah)

    Thx u castillo . But I mean Page navigation is the link come to older post , or newer post .

    I have one answear at stackoverflow :
    You are using custom query, so you need to add $paged parameter like this:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    <?php $lastest= new WP_Query ( array
        (
            'post_type' => post,
            'posts_per_page' => 10,
            'ignore_sticky_posts' => 1,
            'paged' => $paged
        )
        );
    ?>

    But still don’t know how to display it :
    I mean Older post and New post I’m using this php code to call it :

    <?php next_posts_link(); ?>
    <?php previous_posts_link(); ?>

    Note : First time , i use “Your latest posts” at Homepage . It show good but Paged is not right !

    Second time , i use a Static Page for Homepage . Then the text link don’t show up ! Do use know why ? I use PHP Code for Post to insert PHP Code in Page . Then I Design one unique Page named “HomePage” . Design this Page with
    “WPBakery Visual Composer”

    If u know how to fix it plz help me ! Thx so much

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Page navigation don't show up !’ is closed to new replies.