Displaying events on the blog page

Home Forums Welcome! Pre-Sales Questions Displaying events on the blog page

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1017108
    Tomasz
    Guest

    Hello

    I’d like to have calendar events displayed together with another blog posts. I know about the setting of calendar to include events in main loop but this is not a solution for me. This setting display the events just on the main post page and I have several blog pages where I display posts depending on its category. I’d like to have a possibility to select aloso events to be displayed there. It would be perfect to have a possiblity to select them by events category. Is something like this possible with the current plugin functionality?

    regards
    Tomasz

    #1017120
    Geoff
    Member

    Hello Tomasz and thanks for getting in touch!

    You’re right: the setting you mentioned will only have an impact on the main posts query if that query is on the homepage.

    You can, however, add snippets to add events to your other queries as well.  For example, here is a way to add events to anywhere the main query is called in your templates:

    add_action( ‘pre_get_posts’, events_in_main_query’ );
    function events_in_main_query( $query ) {

    if (  $query->is_main_query() ) {
    $query->set( ‘post_type’, array( ‘post’, ‘tribe_events’) ); return $query;
    }

    }

    You can use that as a model for modifying other existing queries, or wrap it in a conditional statement that targets specific templates or pages.

    Does this help? Please let me know. 🙂

    Cheers!
    Geoff

    #1017653
    amy
    Guest

    I am having the same issue as above and added the code to my functions.php (I’m using Genesis framework) and there was no change.

    Can view site here: http://www.parentsinpartnership.net/parents – events show up on the bottom of the home page, but not in “News.”

    Any suggestions?

    #1017839
    Geoff
    Member

    Hello @amy!

    Thanks for chiming in–you’re totally welcome to follow along and use the solutions provided here. If you’d like direct support, I’d recommend opening a new thread and we’d be happy to help you there.

    In the meantime, it appears as though your News section uses a different query than the page you linked me to. My hunch would be that the same technique I provided above will be sufficient if you change it from the main_query to the one being used on the News template. When you open your thread, it would be super helpful to provide the query that’s already being used for News–which you can find in either the News template or in your theme’s functions.php file.

    Cheers!
    Geoff

    #1021984
    amy
    Guest

    I created a new post and was told to ask on the forums. 🙁

    #1022140
    Geoff
    Member

    Sorry for the trouble, @amy. This forum is for Pre-Sales questions related to our premium products. I should have been more clear that if you were having technical issues to post in the open-source forums, but incorrectly assumed you had a premium support license. My apologies for that!

    Geoff

    #1039924
    Geoff
    Member

    Hey there! I see my last reply was marked as the correct answer. thanks for following up! If you have any other questions, please feel free to start a new thread and we’d be happy to help you there. 🙂

    Cheers!
    Geoff

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Displaying events on the blog page’ is closed to new replies.