magnumcreative / magnum-bootstrap-pagination

Changes WP default pagination to Bootstrap 3 style
1 stars 1 forks source link

Create admin panel to control this plugin #1

Open ghost opened 10 years ago

ghost commented 10 years ago

The following would be nice to add

rikdeakin commented 10 years ago

Hello Brett,

Thank you for this plugin and for sharing your info about it on the Roots Forums

I'm having trouble getting any kind of numbered pagination to work with custom post types. If you have a roots template with a loop to show a custom post type, working with your pagination code, I'd be so grateful if you could post it here.

Below is my template file:

<?php
/*
Template Name: Courses Archive
*/
?>

<?php get_template_part('templates/page', 'header'); ?>

<?php if (!have_posts()) : ?>
  <div class="alert alert-warning">
    <?php _e('Sorry, no results were found.', 'roots'); ?>
  </div>
  <?php get_search_form(); ?>
<?php endif; ?>

<?php
echo "loaded: archive-courses.php";
$args = array(
  'post_type' => 'courses',
  'orderby' => 'title',
  'order' => 'ASC',
  'posts_per_page' => 10,
  'paged' => $paged
);
$query = new WP_Query($args);

if($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?>
  <?php get_template_part('templates/content', get_post_format()); ?>
<?php endwhile;
echo "loaded: archive-courses.php"; ?>
<?php if ($wp_query->max_num_pages > 1) : ?>
  <?php page_navi(); ?>
<?php endif; ?>  
<?php endif; ?>

Kind regards, -Rik