Home › Forums › Calendar Products › Events Calendar PRO › include events on front page
- This topic has 8 replies, 5 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
October 19, 2012 at 9:36 am #26864
Rob
ParticipantI am using genesis themes if that helps anything but what I have done is add categories to my events:
add_action( ‘init’, ‘add_calendar_taxonomy’, 0 );
function add_calendar_taxonomy() {
register_post_type(‘tribe_events’,array(
‘taxonomies’ => array(‘category’, ‘post_tag’)
));then try to show posts and events that are marked by that category as follows:
add_action( ‘pre_get_posts’, ‘be_change_event_posts_per_page’ );
function be_change_event_posts_per_page( $query ) {
if( is_home() && $query->is_main_query() ) {
$query->set( ‘cat’, ’15’ );
$query->set( ‘post_type’, array( ‘post’, ‘Events’) );
}
}October 19, 2012 at 1:21 pm #26888Leah
MemberHi Rob,
Have you read over our guide on using Genesis at https://theeventscalendar.com/tutorial-integrating-the-events-calendar-w-genesis/? That might help point you in the right direction. If you need more assistance, feel free to post again here.
Thanks,
LeahOctober 19, 2012 at 2:26 pm #26894Rob
ParticipantHey Leah,
Thanks for the replay, I have watched and read the genesis tutorials and really think they are great. I was not able to make the leap needed from those specific tutorials to solve my current problem. Thanks again.October 19, 2012 at 7:06 pm #26904Leah
MemberHey Rob,
Thanks for the update. We’re heading out for the weekend as usual, but I’ll get someone familiar with Genesis to take a look at this on Monday. Thanks for your patience!
~Leah
October 22, 2012 at 2:14 pm #26985Jonah
ParticipantHi Rob,
Two things, one, it looks like you may have some syntax issues with your code using apostrophes instead of single quotes so make sure it’s not a problem with your code… Two, in this chunk of code:
add_action( ‘pre_get_posts’, ‘be_change_event_posts_per_page’ );
function be_change_event_posts_per_page( $query ) {
if( is_home() && $query->is_main_query() ) {
$query->set( ‘cat’, ’15′ );
$query->set( ‘post_type’, array( ‘post’, ‘Events’) );
}
}
You need to use tribe_events instead of “Events” as the post type, so like so (and I’m also correcting the apostrophes here):
add_action( 'pre_get_posts', 'be_change_event_posts_per_page' );
function be_change_event_posts_per_page( $query ) {
if( is_home() && $query->is_main_query() ) {
$query->set( 'cat', '15' );
$query->set( 'post_type', array( 'post', 'tribe_events') );
}
}
…see if that helps.– Jonah
October 24, 2012 at 5:29 pm #27162Rob
MemberHey again Rob. Just wanted to follow-up on this one to double check if Jonah’s last response got you where you needed to be. Can you confirm, so we can close out this thread or follow-up as needed? Thanks in advance!
October 24, 2012 at 7:52 pm #27164Rob
ParticipantSorry for not posting back that fix is what I needed, you guys rock!
October 25, 2012 at 12:58 pm #27213Leah
MemberGlad to hear it! Thanks Rob!
July 7, 2015 at 6:26 am #978059Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘include events on front page’ is closed to new replies.
