Forum Replies Created
-
AuthorPosts
-
Sara DregneyParticipant
Thank you! How do you pass a button with a clickable link through the api file? I have tried numerous ways of going about this (<button>, ) but so far it’s not working. Do you have suggestions?
Here is my code right now:
function appp_get_hook_data( $object, $field_name, $request ) {
$data = [];
$apppeventid = $object[‘id’];
$apppvenuename = tribe_get_venue($apppeventid);
$apppical = tribe_get_single_ical_link($apppeventid);$appdate = get_post_meta( $object[‘id’], ‘_EventStartDate’, 1 );
$data[‘post_list’][‘below_title’] = ‘<span class=”event-detail-info”>’ . date(‘F j, Y \a\t g:ia’, strtotime($appdate)). ‘<br />’. $apppvenuename. ‘<br />’. ‘</span>’;
$data[‘post_detail’][‘below_title’] = ‘<span class=”event-info”>’ . date(‘F j, Y \a\t g:ia’, strtotime($appdate)). ‘<br />’. $apppvenuename. ‘</span>’;
// Add a featured image to the single post view in the app
$data[‘post_detail’][‘above_title’] = ‘<div class=”post-featured-wrap”>’ . get_the_post_thumbnail( $object[‘id’], ‘large’, array( ‘class’ => ‘post-featured’ ) ) . ‘</div>’;
$data[‘post_detail’][‘below_content’] = ‘<span class=”event-ical”>’ . $apppical. ‘</span>’;return $data;
}Sara DregneyParticipantThank you, Chris!
You can see my code to append to the api file above. When I used the function tribe_get_single_ical_link(), it returns the event url appended with /?ical=1. Is this all that’s needed? When I hover on over the button on the website, the event url is appended with /?ical=1&tribe_display=.
I have not been able to test this to see if it works because I’m not sure the code needed to pass a button with a clickable link through the api file. I tried numerous ways of going about this but so far it’s not working. Do you have suggestions?
Sara DregneyParticipantThanks, Chris. I currently have an app that displays event calendar information. I pull all the data through the api. I want users to be able to put the event from the app to their mobile phone calendar. Since the programming doesn’t link automatically to the ical/gcal calendars, the advice I received from the Apppresser support team was to replicate how The Events Calendar creates the code/link format for the calendars and insert it into my api template hooks.
Therefore, as I understand it, I need to generate the url as the plugin does and then have it accessible in the REST API. Hopefully, I am explaining this correctly and I’ve answered your question. Please let me know what additional questions you may have. Any help is appreciated!
Sara DregneyParticipantI’m not understanding how to put the two things together to create the link to append to my api file. It seems like the class of “Tribe__Events__iCal” needs to be used to get the program to render in the wp-content/plugins/the-events-calendar/src/Tribe/iCal.php. I’m afraid I don’t know how.
Here’s what I’m using right now:
function appp_get_hook_data( $object, $field_name, $request ) {
$data = [];
$apppeventid = $object[‘id’];
$apppvenuename = tribe_get_venue($apppeventid);
$apppical = tribe_get_single_ical_link($apppeventid);$appdate = get_post_meta( $object[‘id’], ‘_EventStartDate’, 1 );
$data[‘post_list’][‘below_title’] = ‘<span class=”event-detail-info”>’ . date(‘F j, Y \a\t g:ia’, strtotime($appdate)). ‘<br />’. $apppvenuename. ‘<br />’. ‘</span>’;
$data[‘post_detail’][‘below_title’] = ‘<span class=”event-info”>’ . date(‘F j, Y \a\t g:ia’, strtotime($appdate)). ‘<br />’. $apppvenuename. ‘</span>’;
// Add a featured image to the single post view in the app
$data[‘post_detail’][‘above_title’] = ‘<div class=”post-featured-wrap”>’ . get_the_post_thumbnail( $object[‘id’], ‘large’, array( ‘class’ => ‘post-featured’ ) ) . ‘</div>’;
$data[‘post_detail’][‘below_content’] = ‘<span class=”event-ical”>’ . $apppical. ‘</span>’;return $data;
}Sara DregneyParticipantThank you, András, for your response. I’ll review and try to work through it a bit.
Sara DregneyParticipantThanks, Victor! I appreciate your response.
I did do additional research and the problem occurs when you “Disable the Event Search Bar” in the settings. I was hoping to simply use the classic header for the cleaner appearance. However, it causes problems with the filters (as described above) and causes problems with mobile formatting.
So, yes, I figured it out just not completely happy with the answer. Thanks again for your time!!
-
AuthorPosts