Home › Forums › Calendar Products › Events Calendar PRO › Embedding Month and Week view in my-template/tribe-events/single-event.php
- This topic has 7 replies, 3 voices, and was last updated 6 years, 7 months ago by Russell Coon.
-
AuthorPosts
-
September 12, 2017 at 10:43 am #1348200Russell CoonParticipant
Hello,
I’m trying to embed the overall calendar on the top of the single event pages. I tried using:
<?php echo do_shortcode( ‘[tribe_events view=”month”]’); ?> (Which returns nothing)
and
<?php tribe_get_template_part( ‘month’ ); ?> (Which returns the calendar template but with an empty calendar)
Is this possible?
September 12, 2017 at 1:13 pm #1348259AndrasKeymasterHi Russel,
Thanks for getting in touch!
Please give me some time until I check if technically it is possible.
In the code you pasted you have used curly quotes. Those usually don’t work. If that’s the case then try correcting them to straight clothes, like this:
<?php echo do_shortcode( '[tribe_events view="month"]'); ?>
Cheers,
AndrasSeptember 12, 2017 at 4:30 pm #1348325Russell CoonParticipantThank you, I had used straight quotes but when I pasted the code into the forum it changed them to curly for some reason. I look forward to hearing your response.
September 12, 2017 at 5:46 pm #1348340MathewParticipantThere may be a handler in place that prevents this. Not to say it’s not doable, with some work. As a side note, [tribe_events_list] embeds just fine in single event. There’s also a GREAT plugin that will create widget areas on single events.
/** * Handler for the [tribe_events] shortcode. * * Please note that the shortcode should not be used alongside a regular event archive * view nor should it be used more than once in the same request - or else breakages may * occur. We try to limit accidental breakages by returning an empty string if we detect * any of the above scenarios. * * This limitation can be lifted once our CSS, JS and template classes are refactored to * support multiple instances of each view in the same request. * * @param $atts * * @return string */
September 13, 2017 at 7:39 am #1348550AndrasKeymasterHello Matthew and thanks for chiming in!
Both of your recommendations are totally viable, thanks!
@Russel, you can try those, or a colleague was kind enough to whip up the following snippet. This should do it as well:
add_action( 'tribe_events_before_view', function( $view ) { if ( false === strpos( $view, 'src/views/single-event.php' ) ) { return; } if ( ! class_exists( 'Tribe__Events__Pro__Shortcodes__Tribe_Events' ) ) { return; } $embedded_view = new Tribe__Events__Pro__Shortcodes__Tribe_Events( array( 'view' => 'month' ) ); echo $embedded_view->render_view(); } );
Let me know if that does the trick.
Cheers,
AndrasSeptember 13, 2017 at 6:13 pm #1348952Russell CoonParticipantYes, that snippet helped and I figured it out. Thank you!
September 14, 2017 at 5:54 am #1349115AndrasKeymasterAwesome! Super stoked to hear!
Since this is marked resolved I am going to close this ticket, but if you need anything else related to this topic or another please create a new ticket and we’ll be happy to help.
Cheers,
AndrasPS: If you like our plugins, and you didn’t yet do so 🙂 we would be happy to receive a review in the wordpress.org repository. Thanks!
https://wordpress.org/support/view/plugin-reviews/the-events-calendar/
https://wordpress.org/support/view/plugin-reviews/event-tickets/PS2: We’d be also grateful if you would give us feedback on your satisfaction with support. Just click on one of the classy looking emojis below. 🙂 If you can spare a few words, that’s even better. Doublethanks!
-
AuthorPosts
- The topic ‘Embedding Month and Week view in my-template/tribe-events/single-event.php’ is closed to new replies.