【问题标题】:Different Pages in WordPress having same Header and footerWordPress中的不同页面具有相同的页眉和页脚
【发布时间】:2018-10-10 11:25:05
【问题描述】:

是否可以在没有插件的情况下在 WordPress 中为 不同页面 使用相同的 页眉和页脚?如果是,如何?

【问题讨论】:

  • 这正是 WP 目前的工作方式。您能否详细解释一下您所遇到的情况,或许可以详细说明您正在使用的主题、指向您网站的链接?
  • Wordpress 已经拥有 get_footer() 和 get_footer() 函数,几乎所有主题都使用它来实现相同的功能。

标签: wordpress header footer


【解决方案1】:

使用 get_header(); & get_footer();在自定义模板上。

首先在主题根目录下制作像 test.php 这样的模板

然后粘贴这个

        <?php
  /**
  * Template Name: Custom Post List
  */
  get_header(); ?>

  <div id="main-content" class="main-content">

  <?php
  if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
    // Include the featured content template.
    get_template_part( 'featured-content' );
  }
 ?>

<div id="primary" class="content-area">
    <div id="content" class="site-content" role="main">

        <h1>Hello There</h1>

    </div><!-- #content -->
</div><!-- #primary -->
  </div><!-- #main-content -->

   <?php
   get_sidebar();
   get_footer();

然后在后台创建页面并选择模板

【讨论】:

猜你喜欢
  • 2016-04-18
  • 1970-01-01
  • 1970-01-01
  • 2012-01-02
  • 2017-10-03
  • 2012-04-26
  • 1970-01-01
  • 2022-12-18
  • 2015-09-29
相关资源
最近更新 更多