Problem With A Custom Theme
-
Hello π
I have a small issue and I can’t determine why that’s happens so I though a good idea to share with you π
I have create a blog which shows the lasted post from all categories this the also the home page of the theme, In this part the plugin is working normally… I will share my code with you at the end of the message..
Now, I have create multiple pages with different templates, because I want to limited the categories, for example in Page Number 1 – I want to be display the post only from the category 1, The plugin is display the pages right but is not working, when I’m clicking page number 2 the url is changing but the posts not, are exactly the same! Also seems like the link is not moving from page one to two, I think I made a mistake with my template…
Any ideas ??
Index.php
<?php get_header(); ?> <div class="row"> <div class="col-xs-12 col-sm-8"> <?php if( have_posts() ): while( have_posts() ): the_post(); ?> <?php get_template_part('content',get_post_format()); ?> <?php endwhile; endif; ?> <div style="text-align:center;"> <?php wp_pagenavi(); ?> </div> </div> <div class="col-xs-12 col-sm-4"> <?php get_sidebar(); ?> </div> </div> <?php get_footer(); ?>content.php
<?php /* * Template name: Uncategorized Page Template */ ?> <?php get_header(); ?> <div class="row"> <div class="col-xs-12 col-sm-8"> <?php $current_page = (get_query_var('paged')) ? get_query_var('paged') : 1; // get current page number $args = array( 'posts_per_page' => get_option('posts_per_page'), // the value from Settings > Reading by default 'paged' => $current_page // current page ); query_posts('cat=1'); $wp_query->is_archive = true; $wp_query->is_home = false; if ( !have_posts() ) { echo ('Sorry, no posts were found'); }else while(have_posts()): the_post(); ?> <?php get_template_part('content',get_post_format()); ?> <?php endwhile; if( function_exists('wp_pagenavi') ) wp_pagenavi(); // WP-PageNavi function ?> </div> <div class="col-xs-12 col-sm-4"> <?php get_sidebar(); ?> </div> </div> <?php get_footer(); ?>page-template-blog.php
<?php /* * Template name: Uncategorized Page Template */ ?> <?php get_header(); ?> <div class="row"> <div class="col-xs-12 col-sm-8"> <?php $current_page = (get_query_var('paged')) ? get_query_var('paged') : 1; // get current page number $args = array( 'posts_per_page' => get_option('posts_per_page'), // the value from Settings > Reading by default 'paged' => $current_page // current page ); query_posts('cat=1'); $wp_query->is_archive = true; $wp_query->is_home = false; if ( !have_posts() ) { echo ('Sorry, no posts were found'); }else while(have_posts()): the_post(); ?> <?php get_template_part('content',get_post_format()); ?> <?php endwhile; if( function_exists('wp_pagenavi') ) wp_pagenavi(); // WP-PageNavi function ?> </div> <div class="col-xs-12 col-sm-4"> <?php get_sidebar(); ?> </div> </div> <?php get_footer(); ?>
The topic ‘Problem With A Custom Theme’ is closed to new replies.