Skip to content

Instantly share code, notes, and snippets.

@DavidPeralvarez
Created December 4, 2018 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidPeralvarez/bda3faf98f2c935a844760f8321987fb to your computer and use it in GitHub Desktop.
Save DavidPeralvarez/bda3faf98f2c935a844760f8321987fb to your computer and use it in GitHub Desktop.
Lección #12 del curso: CSS Grid
<?php
// Add header
add_action( 'genesis_before_content_sidebar_wrap', 'scv_home_jumbotron' );
function scv_home_jumbotron(){
?>
<div class="jumbotron">
<h1>Viajes al centro de la Tierra</h1>
<p>Te invito a descubrir junto con Willy Fog las mejores rutas en el centro de la Tierra.</p>
</div>
<?php
}
// Remove Genesis loop and add custom loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'scv_do_loop' );
function scv_do_loop(){
$args = array(
'post_type' => 'post',
'posts_per_page' => -1
);
$home_query = new WP_Query($args);
if($home_query->have_posts()):
echo '<ul class="travel-posts">';
while($home_query->have_posts()): $home_query->the_post();
?>
<li style="background-image: url(<?php echo get_the_post_thumbnail_url( get_the_ID(), 'medium_large'); ?>);">
<a href="<?php the_permalink(); ?>">
<div class="travel-details">
<h2><?php the_title(); ?></h2>
</div>
</a>
</li>
<?php
endwhile;
echo '</ul><!-- .travel-posts -->';
endif;
wp_reset_postdata();
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment