include events on front page

Home Forums Calendar Products Events Calendar PRO include events on front page

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #26864
    Rob
    Participant

    I 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’) );
    }
    }

    #26888
    Leah
    Member

    Hi 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,
    Leah

    #26894
    Rob
    Participant

    Hey 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.

    #26904
    Leah
    Member

    Hey 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

    #26985
    Jonah
    Participant

    Hi 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

    #27162
    Rob
    Member

    Hey 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!

    #27164
    Rob
    Participant

    Sorry for not posting back that fix is what I needed, you guys rock!

    #27213
    Leah
    Member

    Glad to hear it! Thanks Rob!

    #978059
    Support Droid
    Keymaster

    This 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.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘include events on front page’ is closed to new replies.