Exemple #1
0
		<div class="container">
			<div class="row">
				<div class="col-lg-12">
					<h1><?php 
printf(__('Search Results for: %s', 'briar'), '<span>' . get_search_query() . '</span>');
?>
</h1>
				</div><!-- /.col -->
			</div><!-- /.row -->
		</div><!-- /.container -->
	</div><!-- /.page title -->

	<div class="container">
		<div class="row">
			<div class="<?php 
briar_main_class();
?>
">
				<div class="post-list" id="content" role="main">
				<?php 
if (have_posts()) {
    ?>
					<?php 
    while (have_posts()) {
        the_post();
        ?>
						<div class="row">
							<?php 
        get_template_part('content', get_post_format());
        ?>
						</div>
Exemple #2
0
/**
 * Display a post content
 *
 * @since 1.0
 */
function briar_post_content()
{
    if (has_post_thumbnail() && !is_singular()) {
        global $allowedposttags;
        $main_classes = briar_main_class(false);
        $content = '';
        if (is_search() || is_archive() || has_excerpt() && !is_singular()) {
            $content = get_the_excerpt();
        } else {
            $content = strip_tags(get_the_content());
        }
        $read_more = false;
        $content = trim(mb_ereg_replace('\\s+', ' ', $content));
        $max_chars = 130;
        if (in_array('col-md-12', $main_classes)) {
            $max_chars = 280;
        }
        if (mb_strlen($content) > $max_chars) {
            $read_more = true;
            $content = mb_substr($content, 0, $max_chars) . '...';
        }
        echo wp_kses(apply_filters('the_content', $content), $allowedposttags);
        if ($read_more) {
            printf('<p><a href="%2$s" class="post-item__btn btn--transition">%1$s</a></p>', sprintf(esc_html__('Read more%s', 'briar'), '<span class="screen-reader-text"> ' . get_the_title() . '</span>'), esc_url(get_permalink()));
        }
    } else {
        if (has_excerpt() && !is_singular() || 'audio' !== get_post_format() && 'video' !== get_post_format() && (is_search() || is_archive())) {
            the_excerpt();
            printf('<p><a href="%2$s" class="post-item__btn btn--transition">%1$s</a></p>', sprintf(esc_html__('Read more%s', 'briar'), '<span class="screen-reader-text"> ' . get_the_title() . '</span>'), esc_url(get_permalink()));
        } else {
            the_content(sprintf(__('Read more%s', 'briar'), '<span class="screen-reader-text"> ' . get_the_title() . '</span>'));
        }
    }
}