Php 更改Wordpress 2012主题摘录中标题和特色图像的顺序
当我有一个显示文章摘要的页面时,项目的顺序如下:Php 更改Wordpress 2012主题摘录中标题和特色图像的顺序,php,wordpress,Php,Wordpress,当我有一个显示文章摘要的页面时,项目的顺序如下: 没有链接的特色图片 头衔 总结 我想要的是 头衔 带链接的特色图片 总结 当我查看主题(content.php)的代码时,我遇到了一个名为_extract()的函数。我在主题中找不到此函数,因此无法更新它 <?php if ( is_search() || is_home() || is_tag() ) : // Only display Excerpts for Search ?> <div class="entry-
<?php if ( is_search() || is_home() || is_tag() ) : // Only display Excerpts for Search ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
所以我的问题是
你必须在“片段”周围移动,并添加一些CSS使其看起来很好 在
archive.php
中,用以下代码替换标题
标记(以及标记本身)的内容:
<header class="entry-header">
<?php if ( is_single() ) : ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php else : ?>
<h1 class="entry-title">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
</h1>
<?php endif; // is_single() ?>
<?php if ( ! post_password_required() && ! is_attachment() && !is_single() ) : ?>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
<?php endif; ?>
<?php if ( comments_open() ) : ?>
<div class="comments-link">
<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
</div><!-- .comments-link -->
<?php endif; // comments_open() ?>
</header><!-- .entry-header -->
应该有一个名为archive.php的文件看看……我添加了我的代码,它在content.php中。我在archive.php中找不到任何相关内容。摘录只是创建了一篇文章本身的摘录,与特色图片或标题无关。查看摘录函数调用,您应该会找到它们(查找;标题()
和发布缩略图()
)哦,还有第二个问题;使用感谢你的答案。我得到了正确的链接和顺序。现在,我正在处理css。我必须添加&&!将\u single()添加到\u post\u缩略图()之前的if中,并将永久链接添加到其周围的a href中。出于某种原因,这段代码在2012年的content.php中。不是,我必须调整css以使间距正确。不幸的是,我不能对你的答案投赞成票,因为我的分数不到15分。