Created
October 16, 2018 19:17
-
-
Save luisfelipe-dev/b52e010700d42b9d52268f12f48f0489 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| $args = array( | |
| 'post_type' => 'post', | |
| 'posts_per_page' => 2, | |
| 'orderby' => 'rand', | |
| ); | |
| $loop = new WP_Query( $args ); | |
| while ( $loop->have_posts() ): | |
| $loop->the_post(); | |
| $postcat = get_the_category(); | |
| if ( ! empty( $postcat ) ) { | |
| $category = $postcat[0]->slug ; | |
| $category_name = $postcat[0]->name ; | |
| } | |
| ?> | |
| <div class="conteudo-rodape__item <?= $category ?>" style="background: url('<?= get_the_post_thumbnail_url(); ?>'); background-position: center center; background-size: cover;"> | |
| <div class="texto"> | |
| <div class="texto__cat"> | |
| <a href="javascript:void(0)"> | |
| <?= $category ?> | |
| </a> | |
| </div><!-- /texto__cat --> | |
| <h3> | |
| <?php the_title(); ?> | |
| </h3> | |
| </div><!-- /texto --> | |
| </div><!-- /conteudo-rodape__item --> | |
| <?php endwhile; ?> | |
| <?php wp_reset_query(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment