我正在创建一页wordpress主题-我是wordpress开发人员的新手。一页网站有代表页面的部分。所以首页上的每个部分都是通过管理面板创建的。
有一页。php和主页。
首页需要将所有页面显示为一个部分。
所以我从头版里面的循环开始。php:
<?php get_header(); ?>
<?php
$query = new WP_Query(\'pagename=home\');
if ( $query->have_posts () ) : while ( $query->have_posts() ) : $query->the_post();
get_template_part("page-home");
endwhile; endif;
wp_reset_postdata();
?>
<?php get_footer(); ?>
第一个问题是:get\\u template\\u part没有从主页显示\\u内容()。php,仅显示html标记。这是主页。php
<?php
/*
Template Name: Home
*/
?>
<?php get_header(); ?>
<section id="first_section">
<img class="jumbo wow bounceInDown animated" data-wow-delay="2s" src="<?php echo get_template_directory_uri(); ?>/images/jumbo-illustration.png" alt="Webdesigner and Developer" />
<div class="tagline-wrapper wow bounceInLeft animated" data-wow-delay="2.5s">
<!-- IF the_content() is placed here, it displays the content on front-page -->
<h3 class="tagline"><?php the_content(); ?></h3>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h3 class="tagline"><?php the_content(); ?></h3>
<?php endwhile; ?>
</div>
<?php else : ?>
<p><?php _e( \'Sorry, no posts matched your criteria.\' ); ?></p>
<?php endif; ?>
</section>
<?php get_footer(); ?>
通知<h3 class="tagline"><?php the_content(); ?></h3>
如果在循环中,则首页不会呈现\\u内容,但如果在循环之前,则会正常显示。我错过了什么?
Tnx提前