Trying To Use Gustavo's Plugin

Home Forums Calendar Products Filter Bar Trying To Use Gustavo's Plugin

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1194369
    Shaun
    Participant

    I’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.

    #1194451
    Nico
    Member

    Hey 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,
    Nico

    #1194472
    Shaun
    Participant

    Perfect, it works great.

    Thank you so much!

    #1194606
    Nico
    Member

    Stoked 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

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Trying To Use Gustavo's Plugin’ is closed to new replies.