这很可能有一个非常简单的解决方案。我正在使用Ixion 主题到目前为止,我真的很喜欢它的布局,我几乎准备出版了。但是,该主题设计为仅在首页显示帖子名称、帖子日期和帖子类别。我想另外加上这篇文章的摘录。我找到了在主页上填充最新帖子列表的代码(取自index.php):
while ( have_posts() ) : the_post();
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( \'components/post/content\', get_post_format() );
endwhile;
然后,以下代码对组件/帖子/内容中的每篇帖子进行格式化。php:
<?php
/**
* Template part for displaying posts.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package Ixion
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-body">
<header class="entry-header">
<?php
if ( has_post_thumbnail() && ! is_single() ) : ?>
<div class="post-thumbnail">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail( \'ixion-featured-image\' ); ?>
</a>
</div>
<?php
endif;
if ( ! is_single() ) {
if ( \'post\' === get_post_type() ) {
get_template_part( \'components/post/content\', \'meta\' );
}
the_title( \'<h2 class="entry-title"><a href="\' . esc_url( get_permalink() ) . \'" rel="bookmark">\', \'</a></h2>\' );
}
?>
</header>
<div class="entry-content">
<?php
the_content( sprintf(
/* translators: %s: Name of current post. */
wp_kses( __( \'Continue reading %s <span class="meta-nav">→</span>\', \'ixion\' ), array( \'span\' => array( \'class\' => array() ) ) ),
the_title( \'<span class="screen-reader-text">"\', \'"</span>\', false )
) );
wp_link_pages( array(
\'before\' => \'<div class="page-links">\' . esc_html__( \'Pages:\', \'ixion\' ),
\'after\' => \'</div>\',
) );
?>
</div><!-- .entry-content -->
<?php if ( is_single() ) {
get_template_part( \'components/post/content\', \'footer\' );
} ?>
<?php if ( \'post\' === get_post_type() ) {
ixion_author_bio();
} ?>
</div> <!-- .entry-body -->
具体而言,我已经确定了负责填充每个帖子信息的函数调用,它是:
the_content( sprintf(
/* translators: %s: Name of current post. */
wp_kses( __( \'Continue reading %s <span class="meta-nav">→</span>\', \'ixion\' ), array( \'span\' => array( \'class\' => array() ) ) ),
the_title( \'<span class="screen-reader-text">"\', \'"</span>\', false )
) );
如何修改此函数以包含博客文章的摘录?我既不是PHP开发人员,也不是WordPress开发人员,所以我肯定错过了一些东西。
谢谢