making a pseudo-static page

时间:2013-11-15 作者:user1586214

我正在制作一个伪静态页面,它会驱动我运行。

结构为:

索引。php-->带有页脚,显示最近5篇文章标题服务。html-->这是纯静态的投资组合。html-->这是纯静态博客。php-->这是WP专区(http://www.domain.com/blog)

  • 联系人。html-->这是纯静态的,我最好解释一下:

    In index.php

    <?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 --->
    

    In page-blog.php

    <?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 --->
    
    问题是,我已经让博客工作了,你可以在索引的页脚看到5篇文章的标题。php,并可以在主博客中看到5篇文章。php文件(具有全局站点样式)。但我无法单独查看每个帖子。我想显示的帖子“以同样的方式”我有博客。

    我一直在学习一些tut和技巧,但我不是一个程序员。我读过一些关于将页面制作成WP和链接的文章,但没有成功。我认为问题可能出在permalinks结构中,但现在我完全困惑了。

  • 1 个回复
    SO网友:Por

    创建单个。在themefolder中输入php并插入此代码

    get\\u 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 -->
    

    结束

    相关推荐

    Get_Pages-显示子页,然后显示孙页

    我有一个这样的页面结构。 Portfolio - Residential - - Resident 1 - - Resident 2 - - Resident 3 - Commercial - - Commercial 1 - - Commercial 2 - - Commercial 3 孙辈页面居民1-商业3有帖子缩略图我有一个投资组合页面的模板,我想在其中显