Last active
August 15, 2018 18:37
-
-
Save furenku/7d35eedb5a12ca7d4260bee011386d36 to your computer and use it in GitHub Desktop.
events view
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
.event { | |
border: 1px solid black; | |
background-color: #eee; | |
} | |
.events-list { | |
display: flex; | |
} |
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 | |
/* | |
Plugin Name: Event Views | |
Author: furenku | |
*/ | |
add_action( 'wp_enqueue_scripts', 'enqueue_styles' ); | |
function enqueue_styles() { | |
wp_register_style( 'events-view', plugin_dir_url( __FILE__ ) .'/css/events-view.css' ); | |
wp_enqueue_style( 'events-view' ); | |
} | |
add_shortcode('events-view','events_view'); | |
function events_view() { | |
?> | |
<h1>Events View</h1> | |
<ul class="events-list"> | |
<?php | |
//tribe-ea-record | |
$post_type = 'tribe-ea-record'; | |
// var_dump( get_posts( array('post_type'=>$post_type,'supress_filters' => true ))); | |
$q = new WP_Query( | |
array( | |
// 'post_type'=>$post_type,'supress_filters' => true | |
'post_type' => array( TribeEvents::POSTTYPE, 'revision' ), | |
'post_status' => array( 'publish' ), | |
'eventDisplay' => 'custom', | |
) | |
); | |
if( $q->have_posts() ): | |
while( $q->have_posts() ): | |
$q -> the_post(); | |
?> | |
<article class="event"> | |
<?php | |
echo get_the_title(); | |
echo get_the_excerpt(); | |
echo get_the_post_thumbnail(); | |
echo get_the_permalink( get_the_ID() ); | |
var_dump( | |
date('d/F/y', strtotime(get_post_meta( get_the_ID(),'_EventStartDate',true ))) | |
); | |
?> | |
</article> | |
<?php | |
endwhile; | |
endif; | |
?> | |
</ul> | |
<?php | |
} | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment