Home › Forums › Calendar Products › Events Calendar PRO › Event saved like article
- This topic has 7 replies, 2 voices, and was last updated 11 years, 3 months ago by
Geoff.
-
AuthorPosts
-
January 22, 2015 at 6:51 am #936158
Sabrina
ParticipantHi,
I just install your beautiful plugin.I’d like that when I edit and save an event, some data like title, description and image feature will be saved like a new article in a specific category.
So that I can use this data in other page of my site on a specific theme.Thanks
SabrinaJanuary 22, 2015 at 8:55 am #936232Geoff
MemberHi there, Sabrina! Welcome to the forum and thanks for telling us the plugin is beautiful–we’re super stoked you like it so far. 🙂
The good news is that events are saved just like posts. In fact, they are registered as a custom post type and function much the same way as default WordPress posts.
That means you can query Events just like Posts using the <i>get_posts()</i>. That might looks something like this:
<?php $args = array( 'post_type' => 'tribe-events', 'posts_per_page' => '5', 'exclude' => array( $post->ID ) ); // get posts $posts = get_posts( $args ); // check if any posts are returned if ( $posts ) { ?>Then, you can run your loop to get the data you want, such as the title, start date, end date, description, thumbnail or anything else you need in there. Here’s our entire list of functions to help you find the variables you’re looking for.
Please let me know if this helps answer your question. 🙂
Cheers!
GeoffJanuary 22, 2015 at 9:38 am #936255Sabrina
ParticipantThis reply is private.
January 22, 2015 at 10:07 am #936271Geoff
MemberHi Sabrina and thanks for following up and helping clarify what you’re looking for. There’s a bit of a language barrier here, but hopefully we can figure this thing out together. 🙂
If I’m understanding correctly (and I hope I am!), you have two post types (Posts and Events) and would like to display them together on the homepage. Is that correct?
If so, there is an option under Events > Settings that will make this happen. It will likely be different in your language, but the option is “Include events in main blog loop” (screenshot). If you select that and save your settings, then Posts and Events will both display together on your homepage as long as it is using the main blog loop.
The second thing I hear you mentioning is preventing recurring events from displaying multiple times. There is another option for that in Events > Settings called “Recurring event instances” (screenshot). Select that option and save your settings and then only the first instance of a recurring event will display in your feed.
I hope this helps and does a better job of answering your question! Please let know if this is closer to what you’re looking for or if I’m still missing the mark.
Cheers!
GeoffJanuary 23, 2015 at 2:22 am #936641Sabrina
ParticipantThis reply is private.
January 23, 2015 at 7:47 am #936726Geoff
MemberHey there, Sabrina! Thanks for following up and sharing your code–that’s helpful.
We are unable to support custom development questions here in the forums, but off the bat, I think you will want to check out your content.php file since it contains the content being called and make sure it is properly calling events content that can be displayed. That would be my first stop.
You may also be interested in this post and this thread which show examples of how others used WP_Query to call events. You may also be interested in our tutorial on how to use tribe_get_events() as an alternative.
Cheers!
GeoffJanuary 24, 2015 at 6:43 am #937081Sabrina
ParticipantThis reply is private.
January 26, 2015 at 7:21 am #937580Geoff
MemberNice catch and good work! I’m glad that did the trick. 🙂
I’ll go ahead and close this thread but please feel free to start a new one if anything else comes up and we’d be happy to help.
Cheers!
Geoff -
AuthorPosts
- The topic ‘Event saved like article’ is closed to new replies.
