Skip to content

Instantly share code, notes, and snippets.

@dikiyforester
Created October 22, 2018 05:56
Show Gist options
  • Save dikiyforester/ddb8b17341d501c688c3e0d09766d647 to your computer and use it in GitHub Desktop.
Save dikiyforester/ddb8b17341d501c688c3e0d09766d647 to your computer and use it in GitHub Desktop.
Template to display widget "Vantage - Home Latest Listings" always in a List view
<?php
/**
* Template to display widget "Vantage - Home Latest Listings".
*
* @package Vantage\Templates
* @since 4.0.0
*/
$items = $instance['items'];
set_query_var( 'listing_layout', 'list' );
?>
<div class="row column">
<div class="home-widget-head-wrap">
<?php
if ( ! empty( $instance['header'] ) ) {
echo $instance['before_title'] . $instance['header'] . $instance['after_title'];
}
if ( ! empty( $instance['description'] ) ) {
echo '<p class="home-widget-description">' . $instance['description'] . '</p>';
}
?>
</div> <!-- .home-widget-head-wrap -->
<div class="row listing-wrap small-up-1 medium-up-2 large-up-3">
<?php while ( $items->have_posts() ) : $items->the_post(); ?>
<div class="column">
<?php get_template_part( 'parts/content-item', get_post_type() ); ?>
</div> <!-- .column -->
<?php endwhile; ?>
</div> <!-- .row -->
</div> <!-- .row -->
@dikiyforester
Copy link
Author

dikiyforester commented Oct 22, 2018

Copy this file to your child theme, to the parts/ directory.

small-up-1 medium-up-2 large-up-3 - it is how many columns you will see on small, medium and large screens.

small-up-1 - always one column for all screens
small-up-1 medium-up-2 - one column for small screens, two for all other
small-up-1 medium-up-2 large-up-3 - one column for small screens, two for medium, three for large.

Change it how you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment