Wp-paginate - replace 'older posts' 'newer posts'

Hi. I’m wondering if anyone could advise on how to use the wp-paginate plug-in with GreatMag theme - or if there’s another way of replacing ‘older posts’ and ‘newer posts’ with pagination? Thanks. Oliver

PS - there seem to be php plug-ins suggested for other themes. I wonder if there is something I could add using ‘snippets’? Thanks in advance. Ol

PPS - this documentation to suggest the php changes: https://wordpress.org/plugins/wp-paginate/#installation

(I know nothing! But if that helps!)

1 Like

Hello Oliver,

You might want to check this topic regarding the PHP changes:

Please feel free to ask any other questions that you might have.

Kind Regards, Roman.
aThemes Support

Hi. Thanks for this. Is there any advice you could give on wp-paginate? It looks as if the replacement code there could be relatively simple - using php snippets? (It’s really for the category index pages I’m interested in - rather than within individual posts.) Thanks.

Hi again.

PS - I’ve got this from the wordpress forums: AlanP57 wrote:

I’ve viewed the page and the pagination links are in the page source code but I have not found any way to make them appear. Something in the theme is preventing them form displaying. You could ask the theme author if is possible to make the pagination links appear.

Post Link: https://wordpress.org/support/topic/how-to-get-the-pagination-to-show-on-category-index-pages/#post-12721004

Any help?

Thanks, Oliver

Hello Oliver,

You can try to replace <?php the_posts_navigation(); in archive.php file with this:

<?php if ( function_exists('wp_paginate') ) {
    wp_paginate('range=4&anchor=2&nextpage=Next&previouspage=Previous');
} else {
    the_posts_navigation();
}

Kind Regards, Roman.
aThemes Support

Hi. Thanks for this. I’ve given up on wp-paginate and installed wp-page navi. Could you let me know which code I need to change for the GreatMag theme - specifically with reference to the archive/category index pages? Thanks so much for your time.

PS I see this in archive.php:

<?php the_posts_navigation(); else : get_template_part( 'template-parts/content', 'none' ); endif; ?>

Am in the right area?

Thanks!

Hello Oliver,

You can try to replace this row in archive.php, author.php, and home.php files:

<?php the_posts_navigation();

…with this code:

<?php if ( function_exists('wp_pagenavi') ) {
    wp_pagenavi();
} else {
    the_posts_navigation();
}

…and this row in index.php and search.php files:

the_posts_navigation();

…with this code:

if ( function_exists('wp_pagenavi') ) {
    wp_pagenavi();
} else {
    the_posts_navigation();
}

And please remember that you should override those files in a child theme if you don’t want to repeat these modifications after theme update.

Kind Regards, Roman.
aThemes Support

Hi. Thank you for this. Can I ask, do you have any ready-made ways of creating a child theme for this theme? All advice welcome!

Hello Oliver, you are welcome!

Can I ask, do you have any ready-made ways of creating a child theme for this theme?

We do not have a premade GreatMag child theme, but you can try to use this plugin:

Kind Regards, Roman.
aThemes Support

Thanks again for this. I wonder if I could ask you to look at this page: https://wordaloud.co.uk/category/parables-of-jesus/page/2/ and suggest how I might now drop the navigation down - so that it isn’t disappearing behind the content block, and maybe also have the white background - as per the orginal ‘older posts’ ‘newer posts’. (I’ve added a couple of css changes using custom css.) All advice welcome!

PS - sorry - I’ve been messing with the css…

This is what I now have:.wp-pagenavi { text-align:center; margin-top: 20px;}
.wp-pagenavi a, .wp-pagenavi span {
padding: 5px; background-color: #fff; margin-right: 5px; margin-top: 10px;
font-size: 15px; color: #03719c; text-decoration: none;
border: 3px solid #ccc; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px;
}
.wp-pagenavi a:hover, .wp-pagenavi span.current {
background: #03719c;
color: #fff;
border: 3px solid #AFAFAF;
}
.wp-pagenavi span.current { font-weight: bold; }

to get this: https://wordaloud.co.uk/category/parables-of-jesus/

I’m actually fairly okay with that - or something like - but it would be great to know how I could get the white background box back - as per the original (i.e. with ‘older posts’ newer posts’.)

Thanks.

PPS - Actually, I think I quite like that as is. Thanks so much for your time and help. Oliver

1 Like

Okay, you are welcome Oliver!

Kind Regards, Roman.
aThemes Support