Functions.php
function bittersweet_pagination() {
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'prev_next' => True,
'prev_text' => __('<i class="fa fa-chevron-left"></i>'),
'next_text' => __('<i class="fa fa-chevron-right"></i>'),
'total' => $wp_query->max_num_pages,
'type' => 'array',
) );
if( is_array( $pages ) ) {
$paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
echo '<div class="text-center" style="direction:ltr"><ul class="pagination pagination">';
foreach ( $pages as $page ) {
echo "<li>$page</li>";
}
echo '</ul></div>';
}
}
Index.php:
<?php bittersweet_pagination(); ?>
I tested this too on xampp and worked fine but now it doesn’t work
www.animeio.com
Here’s my pagesource div code from a blog post I placed a <!–nextpage–> tag in the text editor. It seems to work fine, but the text reads so small, a reader will overlook it.
Anyone know how to get my text styling to increase the size of the fonts here?
<p class="content-pagination">
<span class="cp-desc">pages:</span>
<span class="cp-num">1</span>
<a href="https://xxxxxx.com/blog/xxxxxxx/2/">
I’ve tried several things read from forums here, to no avail. Including going into my theme’s “footer code” customizer thing and typing in css like:
‘p.content-pagination {
font-size: 250%;
}`
But I’m thinking that’s not the place for css, and/or it’s not the proper element to style…?
Any help appreciated.
]]>I have a custom home.php in my child theme (of twenty thirteen), and the page nav below the content doesn’t work correctly. Instead of going to previous posts, it just reloads the posts already on home.php. I’ve tried deactivating plugins, which does not help. I temporarily disabled home.php, so that it reverted to index.php in the parent theme, and then the page nav worked correctly. Unfortunately, I still need home.php to work.
Do I have to do something to functions.php in my child theme to make this work?
Here’s the site in question: https://joannagardner.com
Thanks!
]]>https://www.gdaychef.com.au/blog/
At the bottom of the page there are page nav links. They work up until a certain number say 6 or so, then after that they no longer work. If you click on 15 you will see what I mean.
See screenshot below.
https://awesomescreenshot.com/0833m4q7c4
Thanks in advance for any help.
]]>The bottom navigation buttons (1 2 3 4 5 … previous next) don’t work.
They just refresh the same page and just change the link
from
https://santefood.ro/?page_id=264
to
https://santefood.ro/?page_id=264/page/2
But the content is the same…
I tried looking in the index.php but to no avail:
index.php
<?php
global $query_string, $post;
$post_type = get_post_type();
if($post_type == "gallery") {
get_template_part("template","gallery");
} else {
get_header();
get_template_part(THEME_INCLUDES."top");
get_template_part(THEME_INCLUDES."news");
get_template_part(THEME_INCLUDES."sidebar");
get_footer();
}
?>
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'posts_per_page' => 5,
'paged' => $paged
);
query_posts($args);
?>
also i have nav.php but is way to complex for me to understand
<?php
function custom_nav_btn_links($search=0, $page_num) {
$pageURL = 'https://';
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
if ($search == "") {
$pos = strpos($pageURL,"/page/");
$len = strlen($pageURL);
if($pos > 0) {
$pos = strpos($pageURL,"/page/");
$pageURL = substr($pageURL, 0, $pos);
return htmlentities($pageURL."/page/".$page_num);
}
if (substr($pageURL,$len-1) == "/") return htmlentities($pageURL."page/".$page_num);
else return htmlentities($pageURL."/page/".$page_num);
}
else {
$pos = strpos($pageURL,"&paged=");
$len = strlen($pageURL);
if($pos > 0) {
$pos = strpos($pageURL,"&paged=");
$pageURL = substr($pageURL, 0, $pos);
return htmlentities($pageURL."&paged=".$page_num);
}
if (substr($pageURL,$len-1) == "/") return htmlentities($pageURL."&paged=".$page_num);
else return htmlentities($pageURL."&paged=".$page_num);
}
}
/* -------------------------------------------------------------------------*
* BLOG PAGE BUTTONS *
* -------------------------------------------------------------------------*/
function customized_nav_btns($page_num,$max_num_pages,$search=0) {
if($page_num == ''){$page_num = '1';}
if($max_num_pages > 1 ){
$adjacents = 1;
$page=$page_num;
$lastpage=$max_num_pages;
$lpm1 = $lastpage - 1;
$pagination = "";
$next = $page + 1;
$prev = $page - 1;
if($lastpage > 1)
{
//pages
if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<a class=\"active\" href=\"".custom_nav_btn_links($search, $counter)."\"><span>$counter</span></a>";
else
$pagination.= "<a class=\"default\" href=\"".custom_nav_btn_links($search, $counter)."\"><span>$counter</span></a>";
}
}
elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some
{
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= "<a class=\"active\" href=\"".custom_nav_btn_links($search, $counter)."\"><span>$counter</span></a>";
else
$pagination.= "<a class=\"default\" href=\"".custom_nav_btn_links($search, $counter)."\"><span>$counter</span></a>";
}
$pagination.= "<a class=\"default\" href=\"#\"><span>...</span></a>";
$pagination.= "<a class=\"default\" href=\"".custom_nav_btn_links($search, $lpm1)."\"><span>$lpm1</span></a>";
$pagination.= "<a class=\"default\" href=\"".custom_nav_btn_links($search, $lastpage)."\"><span>$lastpage</span></a>";
}
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<a class=\"default\" href=\"".custom_nav_btn_links($search, 1)."\"><span>1</span></a>";
$pagination.= "<a class=\"default\" href=\"".custom_nav_btn_links($search, 2)."\"><span>2</span></a>";
$pagination.= "<a class=\"default\" href=\"#\">...</a>";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= "<a class=\"active\" href=\"#\">".$counter."</a>";
else
$pagination.= "<a class=\"default\" href=\"".custom_nav_btn_links($search, $counter)."\"><span>".$counter."</span></a>";
}
$pagination.= "<a class=\"default\" href=\"#\">...</a>";
$pagination.= "<a class=\"default\" href=\"".custom_nav_btn_links($search, $lpm1)."\"><span>$lpm1</span></a>";
$pagination.= "<a class=\"default\" href=\"".custom_nav_btn_links($search, $lastpage)."\"><span>$lastpage</span></a>";
}
//close to end; only hide early pages
else {
$pagination.= "<a class=\"default\" href=\"".custom_nav_btn_links($search, 1)."\"><span>1</span></a>";
$pagination.= "<a class=\"default\" href=\"".custom_nav_btn_links($search, 2)."\"><span>2</span></a>";
$pagination.= "<a class=\"default\" href=\"#\">...</a>";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<a class=\"active\" href=\"#\">$counter</a>";
else
$pagination.= "<a class=\"default\" href=\"".custom_nav_btn_links($search, $counter)."\"><span>$counter</span></a>";
}
}
}
//next button
if ($page >= 1 && $lastpage > $page)
$pagination.= "<a class=\"next\" href=\"".custom_nav_btn_links($search, $next)."\">".( __( 'Next' , THEME_NAME ))."</a>";
else
$pagination.= "<a class=\"next\" href=\"#\">".( __( 'Next' , THEME_NAME ))."</a>";
//previous button
if ($page <= $lastpage && $page > 1)
$pagination.= "<a class=\"prev\" href=\"".custom_nav_btn_links($search, $prev)."\">".( __( 'Previous' , THEME_NAME ))."</a>";
else
$pagination.= "<a class=\"prev\" href=\"#\">".( __( 'Previous' , THEME_NAME ))."</a>";
}
?>
<!-- BEGIN .pages -->
<table class="pages-1 custom-font-1">
<tr>
<td>
<?php echo $pagination;?>
</td>
</tr>
</table>
<?php
}
}
/* -------------------------------------------------------------------------*
* GALLERY PAGE BUTTONS *
* -------------------------------------------------------------------------*/
function gallery_nav_btns($page_num,$max_num_pages,$search=0) {
if($page_num == '' && $page_num == 0){ $page_num = '1'; }
if($max_num_pages > 1 ){
?>
<table class="pages-1 custom-font-1">
<tr>
<td>
<?php
if($page_num < 4 OR $max_num_pages < 8) {
$start = 1;
if($max_num_pages >= 7 ) {$end = 7;}
else $end = $max_num_pages;
}
else {
if($page_num + 3 > $max_num_pages) {
$end = $max_num_pages;
$start = $end - 7;
}
else {
$start = $page_num - 3;
$end = $page_num + 3;
}
}
for($i = $start; $i <= $end; $i++) {
?><a <?php if($i == $page_num) {?> class="active" <?php } else { ?> class="default" <?php } ?> href="<?php echo custom_nav_btn_links($search, $i); ?>"><span><?php echo $i;?></span></a><?php
}
?>
<a href="<?php if ($page_num < $max_num_pages) {$new_page = $page_num + 1;} else {$new_page = $page_num;} echo custom_nav_btn_links($search, $new_page);?>" class="next"><?php printf ( __( 'Next' , THEME_NAME ));?></a>
<a href="<?php if ($page_num > 1) { $new_page = $page_num - 1;} else {$new_page = 1;} echo custom_nav_btn_links($search, $new_page); ?>" class="prev"><?php printf ( __( 'Previous' , THEME_NAME ));?></a>
</td>
</tr>
</table>
<?php
}
}
?>
]]>I am using shortcode to get posts within a certain category and to limit the amount of posts returned to 10, as below:
[downloads category=4warned per_page=10]
However I am not getting any paging navigation even though there are more than 10 downloads in this category. Has any one come across this issue before?
Cheers.
https://www.ads-software.com/plugins/download-monitor/
]]>If you hover over the buttons you’ll see www.site.com/sitename/page/2 but if you alter the URL and go straight to www.site.com/page/2 its obviously working.
In my admin/settings, I have amy permalink custom settings to “post name”
Anyone know what’s going on?
]]><?php twentyeleven_content_nav( 'nav-above' );
<?php /* Start the Loop */ ?>
<?php //query_posts('paged='.$paged);
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('showposts=5'.'paged='.$paged); ?>
<?php $recentPosts = new WP_Query();
$recentPosts->query('showposts=5'.'&paged='.$paged) ?>
<?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php $wp_query = null; $wp_query = $temp;?>
<?php twentyeleven_content_nav( 'nav-below' ); ?>
Page Navigation is working,
but now I’m having problems excluding a category.
Any code I found with an excluded category messed up the pave nav.
I want to exclude two categories and have a working page navigation, but I continue to go in circles.
Blog site: kydayatcapitol.wordpress.com
Thanks for any assistance!
]]>