我正在制作一个伪静态页面,它驱动着我的位置。
这些结构是:
我最好解释一下我所拥有的:
<?php
/* Short and sweet */
define('WP_USE_THEMES', false);
require('blog/wp-blog-header.php');
?>
<--- HTML --->
<h3>Recent Post</h3>
<?php get_archives('postbypost', '5', 'custom', '<li>', '</li>'); ?>
<--- HTML --->页面中的
<?php
/* Short and sweet */
define('WP_USE_THEMES', false);
require('blog/wp-blog-header.php');
?>
<--- HTML --->
<div class="span9">
<!-- Start the Loop. -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<!-- Test if the current post is in category 3. -->
<!-- If it is, the div box is given the CSS class "post-cat-three". -->
<!-- Otherwise, the div box is given the CSS class "post". -->
<?php if ( in_category('3') ) { ?>
<div class="post-cat-three">
<?php } else { ?>
<div class="post">
<?php } ?>
<!-- Display the Title as a link to the Post's permalink. -->
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. -->
<small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>
<!-- Display the Post's content in a div box. -->
<div class="entry">
<?php the_content(); ?>
</div>
<!-- Display a comma separated list of the Post's Categories. -->
<p class="postmetadata">Posted in <?php the_category(', '); ?></p>
</div> <!-- closes the first div box -->
<!-- Stop The Loop (but note the "else:" - see next line). -->
<?php endwhile; else: ?>
<!-- The very first "if" tested to see if there were any Posts to -->
<!-- display. This "else" part tells what do if there weren't any. -->
<p>Sorry, no posts matched your criteria.</p>
<!-- REALLY stop The Loop. -->
<?php endif; ?>
</div> <!--cierra span 9-->
<div id="sidebar" class="span3">
<?php get_sidebar('right'); ?>
</div>
</div> <!-- /span 9-->
<--- HTML --->问题是,我已经让博客工作了,你可以在index.php的页脚看到5篇文章的标题,也可以在主blog.php文件中看到5篇文章(具有全局站点风格)。但我不能单独看到每个帖子。我想“以同样的方式”展示我的博客。
我一直在跟踪一些图谋和技巧,但我不是一个程序员。我读过一些关于把一页变成WP和链接的文章,但是没有起作用。我认为问题可能出在permalinks的结构上,但在这一点上我完全糊涂了。
发布于 2013-11-15 23:46:45
在主题服务器中创建single.php并插入以下代码
get_header();?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php /* The loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php twentythirteen_post_nav(); ?>
<?php comments_template(); ?>
<?php endwhile; ?>
</div><!-- #content -->
</div><!-- #primary -->https://wordpress.stackexchange.com/questions/123420
复制相似问题