Home › Forums › Welcome! › Pre-Sales Questions › Displaying events on the blog page
- This topic has 6 replies, 1 voice, and was last updated 10 years, 5 months ago by
Geoff.
-
AuthorPosts
-
October 22, 2015 at 2:23 pm #1017108
Tomasz
GuestHello
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
TomaszOctober 22, 2015 at 3:16 pm #1017120Geoff
MemberHello 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!
GeoffOctober 24, 2015 at 9:03 pm #1017653amy
GuestI 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?
October 26, 2015 at 6:40 am #1017839Geoff
MemberHello @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!
GeoffNovember 4, 2015 at 7:36 pm #1021984amy
GuestI created a new post and was told to ask on the forums. 🙁
November 5, 2015 at 6:59 am #1022140Geoff
MemberSorry 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
December 11, 2015 at 4:15 pm #1039924Geoff
MemberHey 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 -
AuthorPosts
- The topic ‘Displaying events on the blog page’ is closed to new replies.
