Home › Forums › Calendar Products › Events Calendar PRO › Problem updating tooltip.php
- This topic has 9 replies, 3 voices, and was last updated 10 years, 6 months ago by
Support Droid.
-
AuthorPosts
-
October 5, 2015 at 8:50 am #1011503
Jessica Hanson
ParticipantI am trying to replace the lines:
[[ if(excerpt.length) { ]]
<p class=”entry-summary description”>[[=raw excerpt]]</p>
[[ } ]]with:
<p class=”entry-summary description”><?php the_field(‘description’); ?></p>
as I am using the plugin “Advanced Custom Fields” that was suggested by your company to add my own fields to the new event admin page. I would like to use this custom code, but when I do the tooltip doesn’t display properly. Which is strange, because I used this same code in the file list/single_event.php without any issues. Any help would be most appreciated, thank you!
October 5, 2015 at 6:45 pm #1011697Brook
ParticipantHowdy Jessica,
That’s a good question. What you are seeing there is a handlebars JS template. This has proven to be something that has confused many users, and apologize that it’s not yet as simple as editing the other templates.
It sounds like you are editing the template ‘/the-events-calendar/src/views/month/tooltip.php’. Any time you want to add information to this template you must first edit ‘/the-events-calendar/src/views/month/single-event.php‘. You will notice that the first 190 lines of the single-event file are a tutorial on how to edit it, including a very applicable example on how to add a post meta field. If you follow the steps outlined in this built-in tutorial you should be able to add your data the single-event.php file, and then show it on tooltip.php.
Does that all make sense? After giving that a whirl have you achieved success?
Cheers!
– Brook
October 6, 2015 at 5:04 pm #1012094Jessica Hanson
ParticipantYea, the instructions are not so helpful.. I just read through them twice.
Am I supposed to only be editing the tooltip.php or some other file?
I added this to the top of the tooltip.php and then added my string to the content below, here is how my file looks now. It returns an error.
<?php
/**
*
* Please see single-event.php in this directory for detailed instructions on how to use and modify these templates.
*
*/$additional_data = array();
$string = the_field(‘description’);
$additional_data[‘description’] = $string;
echo tribe_events_template_data( $post, $additional_data ); ?>?>
<script type=”text/html” id=”tribe_tmpl_month_mobile_day_header”>
<div class=”tribe-mobile-day” data-day=”[[=date]]”>[[ if(has_events) { ]]
<h3 class=”tribe-mobile-day-heading”>[[=i18n.for_date]] <span>[[=raw date_name]]</span></h3>[[ } ]]
</div>
</script><script type=”text/html” id=”tribe_tmpl_month_mobile”>
<div class=”tribe-events-mobile hentry vevent tribe-clearfix tribe-events-mobile-event-[[=eventId]][[ if(categoryClasses.length) { ]] [[= categoryClasses]][[ } ]]”>
<h4 class=”summary”>
[[=title]]
</h4><div class=”tribe-events-event-body”>
<div class=”updated published time-details”>
<span class=”date-start dtstart”>[[=dateDisplay]] </span>
</div>
[[ if(imageSrc.length) { ]]
<div class=”tribe-events-event-image”>
</div>
[[ } ]]
<p class=”entry-summary description”>[[=raw description]]</p>
[[=i18n.find_out_more]]
</div>
</div>
</script>October 7, 2015 at 2:07 pm #1012492Brook
ParticipantHowdy Jessica,
So you actually barely need to modify tooltip.php. The only thing you will need to do is add an HTML element and a call to your data element. Say you named your element ‘descriptionField’ and want to wrap it in a <p> tag then you would add this to the handlebars template in tooltip.php:
<p class="entry-summary description">[[=descriptionField]]</p>That’s it as far as modifications to tooltip.php go. From there you want to modify single-event.php to include your data. You are well on your way already with your code here:
$additional_data = array(); $string = the_field(‘description’); $additional_data[‘descriptionField’] = $string;Copy/paste that into single-event.php. Then add your $addition_data var as a second argument to the existing tribe_events_template_data(). If you scroll down to line 195 of single-event.php you will see this existing call to that function. Just add your data as a second argument to the function and you should be food.
Does that make sense now?
Cheers!
– Brook
October 7, 2015 at 2:53 pm #1012519Jessica Hanson
ParticipantNot entirely…
Where do I copy/paste
into single_event.php at the bottom, the top, anywhere…?
Also, at the bottom of the page, I don’t know what you mean by adding the second argument to this:
<div id=”tribe-events-event-<?php echo esc_attr( $event_id ); ?>” class=”<?php tribe_events_event_classes() ?>” data-tribejson='<?php echo esc_attr( tribe_events_template_data( $post ) ); ?>’>
<h3 class=”tribe-events-month-event-title entry-title summary”>” class=”url”><?php echo $title ?></h3>
</div><!– #tribe-events-event-# –>This is all that is shown at the bottom of the single_event.php
Can you please show me how the last part should be laid out? I don’t want the extra field to be shown on single event month view, just the tooltip and mobile, Thank you!
October 8, 2015 at 11:47 am #1012793Brook
ParticipantHowdy again Jessica,
I do want to clarify something. As our terms of service and support detail our support is intended as a general overview outlining what you will need to do to make a customization. We can not provide you with specific code, or extensively elaborate on every single step. It is up to you and your developing expertise to take the overview and apply it. Now you probably noticed I have already violated our TOS by providing you with specific code in my last response. On rare occasion I can get away with doing that, but it’s an exception.
into single_event.php at the bottom, the top, anywhere…?
You can paste it anywhere. But of course it should be declared before you use it in the tribe_events_template_data() function. Feel free to play around with placing it in the spot that works best for you.
Also, at the bottom of the page, I don’t know what you mean by adding the second argument to this:
See the call to tribe_events_template_data() in that line? That’s where you want to add it. So instead of just including a single argument, you want it to include both as outlined in the guide:
tribe_events_template_data( $post, $additional_data )
Hopefully that helps. These instructions, and the giant guide, are for modifying the handlebars tooltip not adding data to single-event. So you are on the right track. 🙂
I hope you can understand why we have to adhere to our TOS like this. I would truly love it if it were financially tenable to write each line of code of customization for our customers. But, as you’re probably aware many freelancers charge far more than the cost of a plugin per hour to make such customizations. And so our TOS had to choose a happy middle ground when it comes to the level of support we can provide.
Cheers!
– Brook
October 8, 2015 at 3:38 pm #1012911Jessica Hanson
ParticipantThat is understandable and I’m sorry for bothering you! Now the issue I have is when I remove excerpt from the tooltip.php it simply does not work. The tutorial mentions this, but doesn’t go on about how to remove it, any guidance would be much appreciated!
Thanks!
October 9, 2015 at 12:56 pm #1013254Jessica Hanson
ParticipantThis reply is private.
October 9, 2015 at 1:52 pm #1013291Brook
ParticipantThis reply is private.
October 24, 2015 at 7:05 am #1017577Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Problem updating tooltip.php’ is closed to new replies.
