我正在使用TwentyTwenty主题。在搜索结果页面中,它只显示搜索结果文本。我想在搜索结果文本下面显示这些页面的固定链接。要编辑哪个文件。
提前感谢
<?php
$archive_title = '';
$archive_subtitle = '';
if ( is_search() ) {
global $wp_query;
$archive_title = sprintf(
'%1$s %2$s',
'<span class="color-accent">' . __( 'Search:', 'twentytwenty' ) . '</span>',
'“' . get_search_query() . '”'
);
if ( $wp_query->found_posts ) {
$archive_subtitle = sprintf(
/* translators: %s: Number of search results */
_n(
'We found %s result for your search.',
'We found %s results for your search.',
$wp_query->found_posts,
'twentytwenty'
),
number_format_i18n( $wp_query->found_posts )
);
} else {
$archive_subtitle = __( 'We could not find any results for your search. You can give it another try through the search form below.', 'twentytwenty' );
}
} elseif ( ! is_home() ) {
$archive_title = get_the_archive_title();
$archive_subtitle = get_the_archive_description();
}
if ( $archive_title || $archive_subtitle ) {
?>发布于 2020-01-13 22:40:22
我用以下简单的代码创建了search.php:
<?php
/**
* Template Name: Search Page
*/
?>
<?php get_header(); ?>
<main id="site-content" role="main">
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="container" style="font-size: 17px;">
<div class="row">
<div class="col-md-12">
<div class="search-post-excerpt"><?php the_excerpt(); ?></div>
<div class="search-post-link" style="margin-bottom: 10px;"><a href="<?php the_permalink(); ?>"><?php the_permalink(); ?></a></div>
<hr>
</div>
</div>
</div>
<?php endwhile; ?>
<?php get_footer();https://stackoverflow.com/questions/59717457
复制相似问题