Home › Forums › Calendar Products › Events Calendar PRO › EC PRO category to WP post category
- This topic has 7 replies, 2 voices, and was last updated 11 years, 7 months ago by
Geoff.
-
AuthorPosts
-
September 29, 2014 at 5:07 am #775360
gianpiero
ParticipantHi, I’m trying to display all my events into a featured page section of my template but only general WP post categories are shown as options in the template settings and not Event Calendar Categories.
Is it possible to treat Event Calendar Categories like a general WP post category?
The option in the Event Calendar settings “Include events in main blog loop” gets close but I have no idea how to tackle this.
Could you pls advice or put me on the right track
thank you!September 29, 2014 at 5:43 am #775416gianpiero
Participantok, I’ve managed to pull all facebook events modifying my template and replacing ‘cat’ => $cat_id, with ‘cat’ => ‘tribe-events-calendar-pro’, in the relevant array. Now I’m on a mission to pull facebook event dates (at the moment date of publishing is shown).
What is the corresponding get_the_date() in Calendar Event Pro plugin for facebook events?September 29, 2014 at 9:15 am #775907Geoff
MemberHi there Gianpiero,
Great work getting the tribe_events post type into your query. 🙂
You might be interested in checking out our tutorial on using the tribe_get_events() function. This will give you all the flexibility you’re looking for, plus it includes an example of how to work with dates in the query. In short, you can use the arguments for start_date and end_date in your query, or even echo the <i>tribe_get_start_date </i>and <i>tribe_get_end_date</i> as needed.
Will that work for you? Please let me know.
Cheers!
GeoffOctober 1, 2014 at 9:46 am #780900gianpiero
ParticipantHi Geoff, thanks for your reply,
I used tribe_get_start_date but it returns the date of today (?)
Maybe I’ve inserted it in the wrong query? This below is what I amended<?php
$cat_id = get_post_meta($post->ID, ‘wt_meta_sec_left_cat’, true);
$num_posts = get_post_meta($post->ID, ‘wt_meta_sec_left_posts’, true);if (($num_posts < 1) or ($num_posts > 8)) {
$num_posts = 8;
}$args = array(
‘cat’ => ‘tribe-events-calendar-pro’,
‘post_status’ => ‘publish’,
‘ignore_sticky_posts’ => 1,
‘posts_per_page’ => $num_posts,
);$query = new WP_Query( $args );
if ( $query -> have_posts() ) :
while ( $query -> have_posts() ) : $query -> the_post(); ?>
<div class=”item-post”>
<?php if ( has_post_thumbnail() ) { ?>
<div class=”thumb”>
“><?php the_post_thumbnail( ‘wt65_65’ ); ?>
</div>
<?php } ?>
<div class=”post-right”>
<h5>“><?php the_title(); ?></h5>
<div class=”entry-meta”>
<?php
global $post;
$comment_count = get_comments_number($post->ID);
if ($comment_count > 0){
$comment_class = ‘ main-color-bg’;
} else {
$comment_class = ‘ no-comment-bg’;
}
?>
<span class=”comments-bg<?php echo $comment_class; ?>”>
<i class=”fa fa-comment”></i>
<?php comments_popup_link( __(‘0’, ‘wellthemes’), __( ‘1’, ‘wellthemes’), __(‘%’, ‘wellthemes’)); ?>
</span>
<span class=”sep” style=”text-transform: none !important”>Posted on</span><br/><span class=”date”><?php echo tribe_get_start_date(), tribe_get_end_date(); ?></span>
</div></div>
</div><?php
endwhile;
endif;
wp_reset_query(); ?>My eyes are bleeding…
Any suggestion would be mega appreciated
thanksOctober 1, 2014 at 2:16 pm #781302Geoff
MemberSorry your eyes are bleeding! I can see why though. 🙂
Strange, because the start and end dates print correctly when I try inserting those functions in my own setup. I wonder if it has something to do with the functions not being inside the actual query?
Sorry I’m unable to give you a concrete answer and write the customization for you, but I think you’re on the right track. 🙂
Cheers!
GeoffOctober 2, 2014 at 4:42 am #782662gianpiero
ParticipantMorning Geoff,
thanks for your support.
In the end I sorted this out making a custom sidebar with upcoming tribe events and calling get_sidebar(‘custom’) in my featured page. Not very elegant, but it worked.
Just to be greedy.. is there a way to pull featured image thumbs for each event in the widget?
thank youOctober 2, 2014 at 8:00 am #783001Geoff
MemberAwesome, that’s a perfectly legit way to get a sidebar in there. Great work!
You’re not being greedy at all. In fact, we have a video tutorial that will walk you through getting the event thumbnail to display for each event in the list widget. Check that out and let me know if that will work for you. 🙂
Cheers!
GeoffOctober 14, 2014 at 7:59 am #810313Geoff
MemberHey there, Gianpiero! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new a new thread and we’ll help you out. Thanks!
-
AuthorPosts
- The topic ‘EC PRO category to WP post category’ is closed to new replies.
