Please try the [strong] shortcode instead. The [wpmtst] shortcodes will be deprecated soon.
Here’s an example of pagination:
http://demos.wpmission.com/strong-testimonials/the-strong-shortcode/pagination/
I am not familiar with Kriesi pagination.
Alright, that seems fair, however, no matter what limit for testimonials per page I would set, it just does not work and display full list of testimonials, even with strong shortcode
Thanks for doing that. Please post the complete shortcode you’re using.
Looking at your site, the pagination script is not being loaded or called.
Is the shortcode in the page content or is it in a do_shortcode() call in a template?
Your theme is built on Underscores, correct? Please confirm that it calls wp_footer().
That is correct, it’s Underscores with bootstrap.
I am calling it from within from within templates-parts folder, content-atsiliepimas.php (a copy of content-page) file like that:
<?php echo do_shortcode('[strong per_page="5"]'); ?>
It does have wp_footer() in a footer.php file, bellow it I call facebook script and:
<script type="text/javascript">
jQuery(document).ready(function( $ ) {
$('#wpmtst-container').masonry({
columnWidth: 161,
itemSelector: '.result'
});
});
</script>
Thanks. The plugin preprocesses content looking for the [strong] shortcode in order to know which of the plugin’s styles and scripts to enqueue. Using do_shortcode in a template bypasses the preprocessing so the default style, pagination, and slideshow will not work.
Without preprocessing, all the styles and scripts will be loaded in the footer which results in an undesirable Flash of Unstyled Content.
The next release will have proper template functions.
The workaround for using do_shortcode is to assume the role of the preprocessing and enqueue the pagination script and/or stylesheet in your theme.
And your Masonry call should now be something like:
$('.strong-container').masonry({
columnWidth: 161,
itemSelector: '.testimonial'
});
but I have not tested that.
Putting the shortcode in a page but not template itself seems to work well, regarding both styles and pagination.
Could you guide me through the process of enqueueing your pagination script on my theme via function or header/footer file?
Sure. To add the script via functions.php and only on a specific template file (page-test.php in this example):
function my_theme_load_testimonials_pagination() {
if ( is_page_template( 'page-test.php' ) ) {
wp_enqueue_script( 'wpmtst-pager-plugin' );
?>
<script type='text/javascript'>
jQuery(document).ready(function($) {
$(".strong-paginated").quickPager({
pageSize : 2,
currentPage : 1,
pagerLocation : "both" // or "before" or "after"
});
});
</script>
<?php
}
}
add_action( 'wp_head', 'my_theme_load_testimonials_pagination' );
Change pageSize and pagerLocation accordingly; the shortcode attributes will not be parsed.
Use is_page() to load on a specific page instead:
if ( is_page( 'my-page-slug' ) ) {
or
if ( is_page( 'my-page-id' ) ) {
—–
Or, in Underscores, you can add the <script> to header.php above the wp_head() call:
<script type='text/javascript'>
jQuery(document).ready(function($) {
$(".strong-paginated").quickPager({
pageSize : 2,
currentPage : 1,
pagerLocation : "both" // or "before" or "after"
});
});
</script>
Then only add the script in functions.php:
function my_theme_load_testimonials_pagination() {
if ( is_page_template( 'page-test.php' ) ) {
wp_enqueue_script( 'wpmtst-pager-plugin' );
}
}
add_action( 'wp_head', 'my_theme_load_testimonials_pagination' );
I have used this function according to your instructions:
function my_theme_load_testimonials_pagination() {
if ( is_page( '46' ) ) {
wp_enqueue_script( 'wpmtst-pager-plugin' );
?>
<script type='text/javascript'>
jQuery(document).ready(function($) {
$(".strong-paginated").quickPager({
pageSize : 10,
currentPage : 1,
pagerLocation : "both" // or "before" or "after"
});
});
</script>
<?php
}
}
add_action( 'wp_head', 'my_theme_load_testimonials_pagination' );
and it workd flawlessly, thank you a lot for your effort and I need not to worry about my client messing with the shortcode on the page anymore!
Really, appreciate this a lot, thanks again 🙂
You’re welcome. I’m glad we found a good solution.