Posts page navigation

I am using the following code to display posts that belong to my custom post type 'softoffers' using the wp_page_numbers ( plugin in a file pastdeals.php. For some reason which I don't know the page navigation bar never appear.

What's confusing is that I am using the same exact code in another file index.php to display posts of post type 'post' and the page navigation bar appear without any problem!

So can someone please help and tell me what I am exactly doing wrong here?

$temp = $pastDeals;
$pastDeals = null;
$pastDeals = new WP_Query();
if ($pastDeals->have_posts()) : while ($pastDeals->have_posts()) : $pastDeals->the_post();
<?php endwhile;
if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif;
$pastDeals = null; $pastDeals = $temp;
<?php else : ?>
<?php endif; ?>

Thanks for your time and efforts

  • bpilot
    • Site Builder, Child of Zeus

    hmm, well could be...but why did the posts display in pastdeals.php? I mean this file is also out of the loop (I guess)

    Having said so, does this mean that we can only have page navigation on index.php?!

    What if a website have 3 or 5 or 10 pages that contains loops and need page navigation on each? it will be crazy to put all of this in index.php....don't you think so?

  • bpilot
    • Site Builder, Child of Zeus

    Not sure if this will help or not, but I must mention that pastdeals.php is a template I used for a 'Page', so in other words I created a page, and lined it with the template (pastdeals.php)

    I am not sure if this can cause a problem, but I thought of putting this information here, may be it can help in figuring out the cause of my problem

    Any thoughts?

    Thanks in advance for your time

  • bpilot
    • Site Builder, Child of Zeus

    OK, I've found the problem....the problem is that the posts are displayed in a 'page' and for pages, as far as I saw there is 'pages navigation' which is totally different from posts navigation in index.php...

    Now the question which I can't find an answer I can do pages navigation while excluding some pages from being included in the navigation?

    Thanks in advance for your time

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.