首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >创建一个伪静态页面

创建一个伪静态页面
EN

WordPress Development用户
提问于 2013-11-15 23:14:38
回答 1查看 548关注 0票数 0

我正在制作一个伪静态页面,它驱动着我的位置。

这些结构是:

  • index.php ->具有显示最后5个帖子标题的页脚
  • services.html ->这是纯静态的
  • portfolio.html ->这是纯静态的
  • blog.php ->这里是WP区(http://www.domain.com/blog)
  • contact.html ->这是纯静态的

我最好解释一下我所拥有的:

In index.php

代码语言:javascript
复制
<?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 --->

页面中的

-blog.php

代码语言:javascript
复制
<?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的结构上,但在这一点上我完全糊涂了。

EN

回答 1

WordPress Development用户

发布于 2013-11-15 23:46:45

在主题服务器中创建single.php并插入以下代码

get_header();?>

代码语言:javascript
复制
<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 -->
票数 0
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/123420

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档