Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tokopress/4294b00c8f4a10b90df4327eff3eeba5 to your computer and use it in GitHub Desktop.
Save tokopress/4294b00c8f4a10b90df4327eff3eeba5 to your computer and use it in GitHub Desktop.
Eventica - Modify home event template, full width recent post
<?php
$args = array(
'post_status'=>'publish',
'post_type'=> 'post',
'posts_per_page'=>3,
'orderby'=>'date',
'order'=>'DESC',
'ignore_sticky_posts' => true
);
$the_recent_post = new WP_Query( $args );
?>
<?php if( $the_recent_post->have_posts() ) : ?>
<div class="home-recent-posts">
<div class="recent-post-wrap">
<a class="recent-post-nav" href="<?php echo get_permalink( get_option( 'page_for_posts' ) ); ?>">
<?php if( "" != of_get_option( 'tokopress_home_recent_post_text' ) ) : ?>
<?php echo esc_attr( of_get_option( 'tokopress_home_recent_post_text' ) ); ?>
<?php else : ?>
<?php _e( 'All Posts', 'tokopress' ); ?>
<?php endif; ?>
<i class="fa fa-chevron-right"></i>
</a>
<h2 class="recent-post-title">
<?php if( "" != of_get_option( 'tokopress_home_recent_post' ) ) : ?>
<?php echo esc_attr( of_get_option( 'tokopress_home_recent_post' ) ); ?>
<?php else : ?>
<?php _e( 'Recent Updates', 'tokopress' ); ?>
<?php endif; ?>
</h2>
<div class="row">
<?php while ( $the_recent_post->have_posts() ) : ?>
<?php $the_recent_post->the_post(); ?>
<?php
global $tp_post_classes;
$tp_post_classes = 'col-sm-6 col-md-4';
?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
</div>
</div>
</div>
<?php endif; ?>
<?php wp_reset_postdata(); ?>
<?php
/**
* Template Name: Homepage
* Description: The template for displaying Homepage.
*
* WARNING: This file is part of the Eventica parent theme.
* Please do all modifications in the form of a child theme.
*
* @category Page
* @package Templates
* @author TokoPress
* @link http://www.tokopress.com
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<?php get_header(); ?>
<?php if( ! of_get_option( 'tokopress_home_slider_disable' ) ) : ?>
<?php get_template_part( 'block-home/block', 'slider-event' ); ?>
<?php else : ?>
<?php if( ! of_get_option( 'tokopress_page_title_disable' ) ) : ?>
<?php get_template_part( 'block-page-title' ); ?>
<?php endif; ?>
<?php endif; ?>
<div id="main-content" class="home-plus-events">
<?php if( !of_get_option( 'tokopress_home_search_disable' ) ) : ?>
<?php if( class_exists( 'Tribe__Events__Main' ) ) : ?>
<?php get_template_part( 'block-home/block', 'search-event' ); ?>
<?php else : ?>
<?php get_template_part( 'block-home/block', 'search-form' ); ?>
<?php endif; ?>
<?php endif; ?>
<?php if( !of_get_option( 'tokopress_home_upcoming_event_disable' ) ) : ?>
<?php get_template_part( 'block-home/block', 'upcoming-events' ); ?>
<?php endif; ?>
<div class="home-group-box">
<div class="container">
<div class="row">
<?php if( !of_get_option( 'tokopress_home_recent_post_disable' ) ) : ?>
<div class="col-md-12">
<?php else : ?>
<div class="col-md-12">
<?php endif; ?>
<?php get_template_part( 'block-home/block', 'featured-event' ); ?>
<?php if( defined( 'MC4WP_VERSION' ) || class_exists( "MC4WP_Lite" ) ) : ?>
<?php if( !of_get_option( 'tokopress_home_subscribe_disable' ) ) : ?>
<?php get_template_part( 'block-home/block', 'subscribe-form' ); ?>
<?php endif; ?>
<?php endif; ?>
</div>
<?php if( !of_get_option( 'tokopress_home_recent_post_disable' ) ) : ?>
<div class="col-md-12">
<?php get_template_part( 'block-home/block', 'recent-post' ); ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php if( !of_get_option( 'tokopresss_home_testimonials_disable' ) ) : ?>
<?php if( function_exists( 'register_tokopress_testimonial' ) ) : ?>
<?php get_template_part( 'block-home/block', 'testimonial' ); ?>
<?php endif; ?>
<?php endif; ?>
<?php if( !of_get_option( 'tokopresss_disable_brands_sponsors' ) ) : ?>
<?php get_template_part( 'block-home/block', 'brand-sponsors' ); ?>
<?php endif; ?>
</div>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment