I am developing an WordPress template right now. I have a static index page. For my blog posts, I am using a custom template named Blog
. But when I create a page under this Blog
template and try to view the page; it doesn’t show the blog page rather it shows 404.php
I am using these files:
index.php //static index page
blog.php //blog page under Blog template
404.php
This is my site http://ratcat.bugs3.com/samata/
And this is the blog page which isn’t not working http://ratcat.bugs3.com/samata/blog-6
For more help, here is my blog.php main code segment:
<div class="single_post">
<?php
// The Query
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("paged=$page");
// The Loop
if(have_posts()) :
while ( have_posts() ) : the_post();
?>
<table>
<tr>
<td class="left_date">
<h1><?php the_time('d') ?></h1>
<p><?php the_time('M') ?></p>
<span class="year"><p><?php the_time('Y') ?></p></span>
</td>
<td>
<a href="<?php the_permalink(); ?>" ><h2><?php the_title(); ?></h2></a>
<div class="author_tag">
<span class="author">By: <?php the_author_posts_link(); ?></span>
<span class="tag"><?php the_tags(); ?></span>
</div>
<div class="post">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('post-image', array('class' => 'post-thumb')); ?></a>
<p><?php the_excerpt(); ?></p>
<div class="read_comment">
<a href="<?php the_permalink(); ?>" title="Full post"><span class="read">Read more</span></a>
<span class="comment"><?php comments_popup_link('No Comment', '1 Comment', '% Comments'); ?></span>
</div>
</div>
</td>
</tr>
</table>
<div class="clear"></div>
<div class="gap"></div>
<?php
endwhile; ?>
<table class="nav_post">
<tr>
<td><div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">«</span> Previous posts') ); ?></div></td>
<td><div class="nav-next"><?php previous_posts_link( __( 'Next posts <span class="meta-nav">»</span>') ); ?></div></td>
</tr>
</table>
<?php
endif;
// Reset Query
wp_reset_query();
?>
</div>
try some thing like put a template code on your blog.php like paste code
and after that in your admin where your blog page edit your template you can see blog template in dropdown while editing the blog page. hope this will work for you.
Reading this I think your issue is that you should have called the template page-blog.php to have it automatically used as the template for a page with the name (and presumably the slug?) of ‘Blog’.
See the codex here;
http://codex.wordpress.org/Pages#Page_Templates