首页 文章

Wordpress:在一个页面上显示多个静态页面(单页网站)

提问于
浏览
1

将单页网站变成wordpress网站的最佳做法是什么?我应该如何在一个文件(front-page.php,例如)中呈现不同的页面,一个接一个地出现?页面上的每个部分应该是不同的wordpress(静态)页面 . 一个呈现其他模板的模板?

先感谢您!

2 回答

  • 0

    在index.php文件中,使每个部分成为页面名称的后置查询 .

    <section>
    <?php query_posts('pagename=youpagename'); if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <div>the coontent etc.</div>
    <?php endwhile; ?>
    </section>
    
  • 0

    这是我前一段时间使用的一些代码 . 可能会帮助你 . 确保在后端测试ID的匹配页面时 .

    <section id="usp" class="clearfix">
    
        <?php
    
            $pages = get_pages('include=11,212,15,17&sort_column=menu_order');
    
            $count = 0;
    
            foreach($pages as $page)
    
            {
    
            $content = $page->post_excerpt;
    
        ?>
    
        <div class="column">
    
            <div class="inner">
    
                <h2><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h2>
    
                <div class="usp-excerpt"><p><?php echo $content ?></p></div>
    
                <a href="<?php echo get_page_link($page->ID) ?>" title="<?php echo $page->post_title ?>" class="usp-readmore">More&hellip;</a>
    
            </div> <!-- end inner -->
    
        </div> <!-- end column -->
    
        <?php } ?>
    
    </section> <!-- end usp -->
    

相关问题