1

There are so many different questions on how to make pages show page numbers at the bottom but I can't seem to use the concepts explained in those to solve my own problem. I know some PHP and I've used Wordpress for a few years, but this (that seems like it should be simple) is way over my head.

I'm currently working with a pre-made template called Zine. I have nearly everything else how I want it but this page number thing is killing me. I'll admit that I've found a few things here and there that are inefficient or wrong in the code and certain features don't actually work. Furthermore, the support over at the creator's site is sub-par and they usually just direct you to a vague Codex article.

The front page of the blog I'm working on shows the latest posts but it refuses to show page numbers. This gets confusing because it calls to a different part of the template which in turn calls to another, different part of the template (I think). The page in question is Chainsaw Creative

So, here we go.

The static page shown as the index is here:

http://pastebin.com/zxZg1ZWd

It works just fine, but, as I said, there are no page numbers but the loop can be found somewhere else. I don't use the custom post-types in that page so the code <?php get_template_part('last', 'all'); ?> seems to call back to this loop:

<?php 
global $theme;
$args = array( 
'post_type' =>  bd_post_types() ,
'orderby' => 'post_date',
'posts_per_page' => 5
);

$loop = new WP_Query($args);
    if($loop->have_posts()): while ($loop->have_posts()) : $loop->the_post(); ?>
        <?php get_template_part('loop', 'all'); ?>
    <?php endwhile; ?>
    <?php endif; ?>

Which in turn seems to call back to this loop:

    <?php if(get_post_type( $post->ID )=='post'): ?>

        <?php get_template_part('loop', 'post'); ?>

    <?php elseif(get_post_type( $post->ID )=='music-reviews'): ?>

        <?php get_template_part('loop', 'music-reviews'); ?>

    <?php elseif(get_post_type( $post->ID )=='movie-reviews'): ?>

    <?php get_template_part('loop', 'movie-reviews') ?>

<?php elseif(get_post_type( $post->ID )=='game-reviews'): ?>

    <?php get_template_part('loop', 'game-reviews') ?>

<?php elseif(get_post_type( $post->ID )=='book-reviews'): ?>

    <?php get_template_part('loop', 'book-reviews') ?>

<?php endif; ?>

I've tried all that I can to edit the loop that I posted in here, but I can't make it show page numbers. The most success I've had is changing 'posts_per_page' to -1 and making it show all posts. I've tried adding the $paged variable among other things, but none of those seem to work.

An example of what I'm trying to do can be found on an author page of the same blog.

Hopefully that's a good enough explanation as to why the rest of the "Custom Template Pagination" posts haven't been helping me. I've also created custom page templates to show posts from specific categories only but I feel like solving this problem will solve that one as well.

  • 1
    You can save yourself a huge amount of code there by just doing get_template_part('loop', get_post_type( $post->ID ) ); – Tom J Nowell May 14 '14 at 15:44
  • Also is there any reason you've chosen a static page template for this rather than using the built in post archives/etc? – Tom J Nowell May 14 '14 at 15:45
  • Ahh, sorry I forgot to mention that it's a pre-made template that I'm using. I didn't write any of the code, I just tinker with it. The reason it uses a static front page, presumably, is because it has that fancy slider thing at the top and it only shows on the front page. I can change it to be a page that has page numbers but doesn't have the slider or the signup form. – Pquch May 14 '14 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.