//Some code here that will find out if there is newer entries...
<?php next_posts_link('<') ?>
<?php
if(!empty($_GET["paged"])) {
echo '<strong>'.$_GET["paged"].'</strong>';
}
else { echo "<strong> 1 </strong>"; }
?>
//Some code here that will find out if there is privious entries...
<?php previous_posts_link('>') ?>
No sorry, those can’t help me.
Because I just want one left arrow, and one right arrow.
(Or i don’t want, but my client does…)
And even if there’s no “Next page”, I want the arrow to still be there, but not as a link.
So the thing I need is some function that will find out if there is a “next link” or “previous link”…
Thanks!
Felix Karlsson
Try adding “<?php wp_link_pages(array(‘before’ => ‘<p>Pages: ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>” to the page and single PHP files.
Can you elaborate that?
I can’t see how that would solve the problem, sorry.
Thanks!
Felix Karlsson
This will put the “next” or “>” for your pages.
Weird, it doesnt work? :S
Works for me. See it in action on my site. Click on my profile to get to see it working on my site.
Thanks,
Oh, but I don’t want it like that. 😛
I just want “< number >”
number = The page that you’re at
The arrows are the next-link and previous-link.
And even though there is no next/previous link, there should be an unclickable arrow.
Don’t know how to explain it better.
Ex. <1>
Thanks
Felix Karlsson
I really need to solve this people, any suggestions?
Thanks
Felix Karlsson
If you have this..
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Divide the IF and WHILE conditions like so..
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
Then place this between them..
<?php
$totalposts = $wp_query->found_posts;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$per_page = get_query_var('posts_per_page');
$last_page = ceil($totalposts / $per_page);
if($paged > 1) { previous_posts_link('<'); }
else { echo '<';}
echo $paged;
if($last_page > $paged) { next_posts_link('>'); }
else { echo '>';}
?>
That what you’re after? 🙂
That’s exactly what I want! 😀
But I use the next link first, so I go back to earlier entries with “<” 🙂
Thanks a lot!
You’re my hero 😉
Felix Karlsson
Hey felixkarlsson do you have the code for what you did? I would like to try it out too.
Thanks.
Hey!
I use this:
<?php
$totalposts = $wp_query->found_posts;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$per_page = get_query_var('posts_per_page');
$last_page = ceil($totalposts / $per_page);
if($last_page > $paged) { next_posts_link('< '); }
else { echo '< ';}
echo "<strong>" .$paged. "</strong>";
if($paged > 1) { previous_posts_link(' >'); }
else { echo ' >';}
?>