ihr-landing-site/content/themes/ihr/templates/content-blog.php

110 строки
2.3 KiB
PHP

<div class="blog">
<?php
$post_objects = get_field('feature_posts');
if( $post_objects ): ?>
<?php foreach( $post_objects as $post): // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post); ?>
<div class="featured-post">
<div class="cell">
<?php the_post_thumbnail('medium_large'); ?>
<div class="copy">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php get_template_part('templates/entry-meta'); ?>
<a href="<?php the_permalink(); ?>"><?php the_excerpt(); ?></a>
</div>
</div>
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif;
?>
<div class="blog-filter-container">
<ul class="blog-filters" id="blog-filters">
<?php
$args = array(
'current_category' => 0,
'echo' => 1,
'hide_empty' => 0,
'show_option_all' => __( 'Most Recent'),
'title_li' => '',
'use_desc_for_title' => 1,
);
wp_list_categories($args);
?>
</ul>
<form role="search" method="get" class="search-form" action="<?php echo home_url(); ?>">
<input type="hidden" value="post" name="post_type" id="post_type" />
<label for="blog-search" class="hidden-label">Email: </label>
<input type="search" class="search-field" value="" name="s" id="blog-search">
<input type="hidden" name="lang" value="<?php echo ICL_LANGUAGE_CODE; ?>" />
<button type="submit" class="search-submit" value="Search"><span class="icon-search"></span></button>
</form>
</div>
<?php
//$args = array('post__not_in' => array( 25 ));
$args = array('posts_per_page'=>10,'suppress_filters' => 0);
$post_objects = get_posts($args);
if( $post_objects ): ?>
<div class="featured-blog-posts" id="posts-wrap">
<?php foreach( $post_objects as $post): // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post); ?>
<?php get_template_part('templates/content'); ?>
<?php endforeach; ?>
</div>
<div class="loader">
<div class="read-more load-more"><?php _e('Load more blog posts','ihr'); ?></div>
<div class="spinner"></div>
</div>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif;
?>
</div>