Home › Forums › Calendar Products › Filter Bar › Trying To Use Gustavo's Plugin
- This topic has 4 replies, 3 voices, and was last updated 9 years, 5 months ago by
Shaun.
-
AuthorPosts
-
November 18, 2016 at 3:36 am #1194369
Shaun
ParticipantI’m trying to add ticket price to my calendar/month view like the OP here: https://theeventscalendar.com/support/forums/topic/add-organizer-venue-and-price-info-to-tooltips-in-week-and-month-view-2/
It sounds like Gustavo’s plugin should do the trick: https://github.com/bordoni/tec-forum-support/tree/plugin-945349
I have uploaded and activated it and added the following code to my tooltip.php
[[ if(price) { ]] <div class="entry-price">Price: [[=raw price]]</a></div> [[ } ]]But nothing shows up.
When I remove the ‘if’ statement it will show the plain text: ‘Price:’ (and HTML div is there in source) but not include the price.
Am I missing something?
If it helps, here is the tooltip.php in it’s entity.
<script type="text/html" id="tribe_tmpl_tooltip"> <div id="tribe-events-tooltip-[[=eventId]]" class="tribe-events-tooltip"> <h4 class="entry-title summary">[[=title]]</h4> <div class="tribe-events-event-body"> <div class="tribe-event-duration"> <abbr class="tribe-events-abbr tribe-event-date-start">[[=dateDisplay]] </abbr> <p class="callnowline">Call <strong>01204 238046</strong> to book or click:</p> </div> [[ if(imageTooltipSrc.length) { ]] <div class="tribe-events-event-thumb"> <img src="[[=imageTooltipSrc]]" alt="[[=title]]" /> </div> [[ } ]] [[ if(excerpt.length) { ]] <p class="tribe-event-description">[[=raw excerpt]]</p> [[ } ]] [[ if(categories.length) { ]] <p class="tribe-event-categories">[[=raw categories]] <a href="[[=permalink]]" class="url booknowbutton">Book Now</a></p> [[ } ]] [[ if(price) { ]] <div class="entry-price">Price: [[=raw price]]</a></div> [[ } ]] <span class="tribe-events-arrow"></span> <p class="tribe-event-booknow"></p> </div> </div> </script>Thanks in advance for any help.
November 18, 2016 at 7:32 am #1194451Nico
MemberHey Shaun,
Thanks for getting in touch! Looks like Gustavo’s code is a bit outdated. I’ll share an updated solution ๐
Just un-install the support plugin, and past the snippet bwlo in your theme’s (or child theme’s) functions.php file:
/* Tribe, add price to tootltip data array */
/* You'll need to add the price output to your template override of tooltip.php */
function tribe_add_price_tooltip_data( $json, $event, $additional ){$json['price'] = 0;
if ( tribe_get_cost() ) {
$json['price'] = tribe_get_cost( null, true );
}return $json;
}add_filter( 'tribe_events_template_data_array', 'tribe_add_price_tooltip_data', 10, 3 );
Once that’s done, create a template override (more details on our themer’s guide) of the tooltip.php file. Just add the lines you where adding in the sample you shared:
[[ if(price) { ]]Price: [[=raw price]][[ } ]]
Please let me know if this works for you,
Best,
NicoNovember 18, 2016 at 8:16 am #1194472Shaun
ParticipantPerfect, it works great.
Thank you so much!
November 18, 2016 at 9:57 am #1194606Nico
MemberStoked to hear Shaun, thanks for confirming ๐
Iโll go ahead and close out this thread, but if you need help with anything else please donโt hesitate to create a new one and we will be happy to assist you.
Best,
Nico -
AuthorPosts
- The topic ‘Trying To Use Gustavo's Plugin’ is closed to new replies.
