2013-04-05 106 views
2

我正在开发Wordpress模板。我有一个静态索引页面。对于我的博客文章,我使用的是名为Blog的自定义模板。但是,当我在此Blog模板下创建一个页面并尝试查看该页面时;它不显示的博客页面,而它显示404.php404正在工作,而不是自定义博客模板

我使用这些文件:

index.php //static index page 
blog.php //blog page under Blog template 
404.php 

这是我的地盘http://ratcat.bugs3.com/samata/ 这是一个不工作不http://ratcat.bugs3.com/samata/blog-6

博客页面

如需更多帮助,这是我blog.php的主代码段:

  <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">&laquo;</span> Previous posts')); ?></div></td> 
          <td><div class="nav-next"><?php previous_posts_link(__('Next posts <span class="meta-nav">&raquo;</span>')); ?></div></td> 
         </tr> 
        </table> 
        <?php 
        endif; 
        // Reset Query 
        wp_reset_query(); 
       ?> 
      </div> 
+0

确定首先检查是否导致我的永久链接结构更改您的永久链接默认并查看是否发生任何事 – anstrangel0ver 2013-04-05 10:03:53

+0

您可以粘贴您的永久链接设置并检查重写模块是否启用。 – 2013-04-05 11:04:25

+0

什么都没有发生。同样的404问题。有一件事,当我在它下面创建一个页面时,我也有一个名为Personal Journey的自定义模板。该页面正常工作。 @ anstrangel0ver – 2013-04-05 11:20:44

回答

1

尝试一些东西一样把模板代码在你blog.php的像粘贴代码

<?php 
/* 
* Template name: blog Template 
*/ 
?> 

,然后在你的管理员那里你的博客页面编辑你的模板,你可以在编辑博客页面时在下拉菜单中看到博客模板。希望这会对你有用。

+0

我使用自定义模板名称作为“博客”:(现在它工作正常。 非常感谢。 – 2013-04-05 11:53:27

1

读这个我个解决你的问题是你应该调用模板page-blog.php让它自动用作页面的模板,这个页面的名字(可能是slu??)的'Blog'。

查看codex here;

http://codex.wordpress.org/Pages#Page_Templates

的WordPress模板层次还可以自动识别特定页面或 文章,而不需要将它们分配给特定的页面 模板文件。如果用户创建模板文件名为 的ID为ID或段落的页面,则自动使用相应的页面模板文件 。

页面级(编号).PHP

页面级{}塞.PHP

+0

是的,我使用自定义模板名称作为“博客”:(现在它工作正常,非常感谢。 – 2013-04-05 11:52:54

相关问题