search results excerpts changed to match design

This commit is contained in:
Maggie Cabrera 2020-10-13 16:25:01 +02:00
parent 83dce15d4a
commit a22d5440d9
8 changed files with 176 additions and 2 deletions

View file

@ -0,0 +1,5 @@
.site-main > article > .entry-footer {
margin-top: calc( var(--global--spacing-vertical) / 2);
padding-top: 0;
border: none;
}

View file

@ -0,0 +1,13 @@
.search-results {
.site-main > * {
padding: var(--global--spacing-vertical) 0;
}
.entry-title {
font-size: var(--heading--font-size-h2);
}
.entry-header {
margin-bottom: 0;
}
}

View file

@ -20,3 +20,5 @@ Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-me
@import "text";
@import "header";
@import "block-extends";
@import "search";
@import "meta";

View file

@ -245,3 +245,59 @@ add_filter( 'the_content_more_link', 'spearhead_continue_reading_link' );
// Filter the excerpt
add_filter( 'get_the_excerpt', 'spearhead_the_excerpt' );
* Post footer meta
*/
if ( ! function_exists( 'spearhead_entry_meta_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function spearhead_entry_meta_footer() {
spearhead_posted_on();
// Edit post link.
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers. */
__( 'Edit <span class="screen-reader-text">%s</span>', 'seedlet' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
),
'<span class="edit-link">',
'</span>'
);
}
endif;
if ( ! function_exists( 'spearhead_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time.
*/
function spearhead_posted_on() {
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf(
$time_string,
esc_attr( get_the_date( DATE_W3C ) ),
esc_html( get_the_date( 'M d Y' ) ),
esc_attr( get_the_modified_date( DATE_W3C ) ),
esc_html( get_the_modified_date() )
);
printf(
'<span class="posted-on"><a href="%1$s" rel="bookmark">%2$s</a></span>',
esc_url( get_permalink() ),
$time_string
);
}
endif;

60
spearhead/search.php Normal file
View file

@ -0,0 +1,60 @@
<?php
/**
* The template for displaying search results pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* @package Seedlet
* @since 1.0.0
*/
get_header();
?>
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?>
<?php get_search_form(); ?>
<?php
// Start the Loop.
while ( have_posts() ) :
the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header default-max-width">
<?php
if ( is_sticky() && is_home() && ! is_paged() ) {
printf( '<span class="sticky-post">%s</span>', _x( 'Featured', 'post', 'seedlet' ) );
}
the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
?>
</header><!-- .entry-header -->
<footer class="entry-footer default-max-width">
<?php spearhead_entry_meta_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-${ID} -->
<?php
// End the loop.
endwhile;
// Previous/next page navigation.
seedlet_the_posts_navigation();
// If no content, include the "No posts found" template.
else :
get_template_part( 'template-parts/content/content-none' );
endif;
?>
</main><!-- #main -->
</section><!-- #primary -->
<?php
get_footer();

View file

@ -308,4 +308,22 @@ Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-me
font-family: var(--global--font-primary);
font-size: var(--global--font-size-xs);
text-transform: uppercase;
}
.search-results .site-main > * {
padding: var(--global--spacing-vertical) 0;
}
.search-results .entry-title {
font-size: var(--heading--font-size-h2);
}
.search-results .entry-header {
margin-bottom: 0;
}
.site-main > article > .entry-footer {
margin-top: calc( var(--global--spacing-vertical) / 2);
padding-top: 0;
border: none;
}

View file

@ -310,4 +310,22 @@ Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-me
text-transform: uppercase;
}
.search-results .site-main > * {
padding: var(--global--spacing-vertical) 0;
}
.search-results .entry-title {
font-size: var(--heading--font-size-h2);
}
.search-results .entry-header {
margin-bottom: 0;
}
.site-main > article > .entry-footer {
margin-top: calc( var(--global--spacing-vertical) / 2);
padding-top: 0;
border: none;
}
/*# sourceMappingURL=style.css.map */

File diff suppressed because one or more lines are too long