我正在使用wordpress single.php模板这是我的代码:
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>
这会生成所有帖子的数据,以及标题,内容,作者和日期信息。帖子的标题包含在<h1>
标记中,我需要将其更改为<h2>
标记。有什么帮助吗?
这是我上面代码的结果:
<article id="post-37" class="post-37 post type-post status-publish format-standard hentry category-home-intro">
<header class="entry-header">
<h1 class="entry-title">About Us</h1>
</header><!-- .entry-header -->
<div class="entry-content">
<p>Vivamus condimentum elementum arcu, ac fermentum lectus porttitor sed. Praesent ornare feugiat condimentum. Praesent sagittis metus id magna adipiscing convallis. Vivamus condimentum elementum arcu, ac fermentum lectus porttitor sed. Praesent ornare feugiat condimentum. Praesent sagittis metus id magna adipiscing convallis. Vivamus condimentum elementum arcu, ac fermentum lectus porttitor sed. Praesent ornare feugiat condimentum. Praesent sagittis metus id magna adipiscing convallis. Vivamus condimentum elementum arcu, ac fermentum lectus porttitor sed. Praesent ornare feugiat condimentum. Praesent sagittis metus id magna adipiscing convallis. Vivamus condimentum elementum arcu, ac fermentum lectus porttitor sed. Praesent ornare feugiat condimentum. Praesent sagittis metus id magna adipiscing convallis. Vivamus condimentum elementum arcu, ac fermentum lectus porttitor sed. Praesent ornare feugiat condimentum. Praesent sagittis metus id magna adipiscing convallis. Vivamus condimentum elementum arcu, ac fermentum lectus porttitor sed. Praesent ornare feugiat condimentum. Praesent sagittis metus id magna adipiscing convallis. Vivamus condimentum elementum arcu, ac fermentum lectus porttitor sed. Praesent ornare feugiat condimentum. Praesent sagittis metus id magna adipiscing convallis.</p>
</div><!-- .entry-content -->
<footer class="entry-meta">
This entry was posted in <a href="http://localhost/?cat=4" title="View all posts in Home Intro" rel="category">Home Intro</a> on <a href="http://localhost/?p=37" title="10:51 am" rel="bookmark"><time class="entry-date" datetime="2013-11-17T10:51:48+00:00">November 17, 2013</time></a><span class="by-author"> by <span class="author vcard"><a class="url fn n" href="http://localhost/?author=1" title="View all posts by Engr Zardari" rel="author">Engr Zardari</a></span></span>. </footer><!-- .entry-meta -->
</article>
答案 0 :(得分:3)
您应该查看 content.php 。
您可以在此处更改与get_template_part( 'content', get_post_format() );
对应的HTML代码。
答案 1 :(得分:0)
我不知道为什么会改变 内容page.php文件 帮助我轻松地将h1标签更改为h2标签。以下是代码。
<h2><?phpthe_title();?></h2>
<article class="content-area">
<?php
the_post_thumbnail();
the_content();
?>
</article>