Last active
October 20, 2015 22:23
-
-
Save dkruchok/6e36e642ea5da2577011 to your computer and use it in GitHub Desktop.
WP Loop with query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( have_posts() ) : // если имеются записи в блоге. | |
query_posts('cat=3'); // указываем ID рубрик, которые необходимо вывести. | |
while (have_posts()) : the_post(); // запускаем цикл обхода материалов блога | |
?> | |
<?php the_post_thumbnail(array(100, 100)); ?> | |
<? endwhile; // завершаем цикл. | |
endif; | |
/* Сбрасываем настройки цикла. Если ниже по коду будет идти еще один цикл, чтобы не было сбоя. */ | |
wp_reset_query(); | |
?> | |
<div <?php post_class("slide-item"); ?> style="background-image: url(<?=$url?>);"> | |
<div class="post-content"> | |
<header class="entry-header"> | |
<div class="inner"> | |
<div class="inner-cell"> | |
<div class="entry-meta"> | |
<?php if( $ti_option['site_author_name'] == 1 ) { ?> | |
<span class="vcard author"> | |
<?php _e( 'By','themetext' ); ?> | |
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" class="url fn n" rel="author"> | |
<?php the_author_meta( 'display_name' ); ?> | |
</a> | |
</span> | |
<?php } ?> | |
<?php ti_meta_data(); ?> | |
</div> | |
<h2 class="entry-title"> | |
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> | |
</h2> | |
<a class="read-more" href="<?php the_permalink() ?>"><?php _e( 'Read More', 'themetext' ); ?></a> | |
</div> | |
</div> | |
</header> | |
<div class="exerpt"> | |
<p><?php the_excerpt(); ?></p> | |
</div> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment