Home › Forums › Calendar Products › Events Calendar PRO › Problems adding a facebook button to an event
- This topic has 10 replies, 2 voices, and was last updated 7 years, 10 months ago by Josh.
-
AuthorPosts
-
May 12, 2016 at 10:48 am #1113925LluísParticipant
Hello, We’re using events calendar pro pluggin.
We’ve made a customized event view where there are two buttons, one for selling tickets and another for facebook.
The selling tickets button works perfectly but the other doesn’t work.
Could you help us or tell us what’s wrong, please?Single event’s Php code attached below:
<?php
/**
* Single Event Template
* A single event. This displays the event title, description, meta, and
* optionally, the Google map for the event.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/single-event.php
*
* @package TribeEventsCalendar
*
*/if ( ! defined( ‘ABSPATH’ ) ) {
die( ‘-1’ );
}$events_label_singular = tribe_get_event_label_singular();
$events_label_plural = tribe_get_event_label_plural();$event_id = get_the_ID();
$additional_fields = tribe_get_custom_fields();
?>
<div id=”tribe-events-content” class=”tribe-events-single”>
<!– Notices –>
<?php tribe_the_notices() ?><?php echo tribe_event_featured_image( $event_id, ‘full’, false ); ?>
<div class=”tribe_events_the_data”>
<!– Title –>
<?php the_title( ‘‘, ‘
‘ ); ?>
<!– Date –>
<p class=”event_date”>
<?php echo tribe_get_start_date( $post->ID, true, ‘l’ ) . ‘ ‘; ?> ,
<?php echo tribe_get_start_date( $post->ID, true, ‘d’ ) . ‘ ‘; ?> de
<?php echo tribe_get_start_date( $post->ID, true, ‘F Y’ ) . ‘ ‘; ?> //
<?php echo tribe_get_start_date( $post->ID, true, ‘H:i’ ) . ‘ ‘; ?>
</p>
<!– The Cost –>
<div class=”tribe-event-cost”>
<p>
<?php if($additional_fields[‘Entrada Anticipada’]) : ?>
Anticipada:
<?php echo $additional_fields[‘Entrada Anticipada’]; ?>
<?php endif; ?><?php if($additional_fields[‘Entrada Taquilla’]) : ?>
Taquilla:
<?php echo $additional_fields[‘Entrada Taquilla’]; ?>
<?php endif; ?>
</p>
</div>
<!– Event Buy –>
<?php $url = tribe_get_event_website_url(); ?><?php if ( $url ) : ?>
<div class=”tribe-events-event-button”>
” class=”my-button-class single-event-button”>Comprar
</div>
<?php endif; ?><!– Content –>
<?php the_content(); ?><!– Event Buy –>
<?php $url_facebook = $additional_fields[‘Evento Facebook’]; ?>
<?php if ( $url_facebook ) : ?>
<div class=”tribe-events-event-button button-facebook”>
” class=”my-button-class single-event-button facebook”>Evento Facebook
</div>
<?php endif; ?>
</div><div class=”tribe-events-schedule tribe-clearfix”>
<?php if ( tribe_get_cost() ) : ?>
<span class=”tribe-events-divider”>|</span>
<span class=”tribe-events-cost”><?php echo tribe_get_cost( null, true ) ?></span>
<?php endif; ?>
</div><!– Event header –>
<!– #tribe-events-header –>
<!– Event footer –>
<!– #tribe-events-footer –>
</div><!– #tribe-events-content –>
Thanks for your time.
May 12, 2016 at 1:04 pm #1114006JoshParticipantHey Luis,
Thanks for reaching out to us!
Would you be able to provide a link to your site, you can add as a private reply if you like, so I can get a closer look at the exact issue you’re experiencing with the button?
Thanks!
May 13, 2016 at 7:36 am #1114249LluísParticipantThis reply is private.
May 16, 2016 at 10:42 am #1115013JoshParticipantHey Lluis,
Thanks for providing those links!
Also, would you mind copying the code into a Gist via?
It looks like the pasted code above is getting formatted oddly and stripping out while trying to link portions of your button code. Having it as a gist will allow me to see the full code.
Thanks!
May 17, 2016 at 7:54 am #1115352LluísParticipantThis reply is private.
May 17, 2016 at 7:56 am #1115353LluísParticipantHope it will be enough.
If there’s any problem just tell me.
Thanks.May 18, 2016 at 8:03 am #1115881JoshParticipantHey Lluis,
Thanks for adding that! Which field type is being used in the additional fields section there when you created the Facebook URL field? Also, can you try doing a “var_dump($url_facebook);” to see what that is giving you there?
Thanks!
May 19, 2016 at 8:42 am #1116428LluísParticipantThis reply is private.
May 20, 2016 at 6:25 am #1116944JoshParticipantHey Lluis,
I see what’s happening here. When using the URL field type, the additional fields output there will output a linked version of the value to itself so you would get something like “http://facebook.com“. This gets thrown off a little bit when trying to set the value of the field as the link within an tag.
The simplest way to use the value the way that you would like would be to change the field type to a traditional text field within your additional fields settings.
Let me know if this helps.
Thanks!
May 20, 2016 at 9:23 am #1117064LluísParticipantYes!
It finally works!
Thanks for the support!May 23, 2016 at 8:23 pm #1118069JoshParticipantHey,
No problem!
I’ll go ahead and close this thread for now. If you have any further questions, please don’t hesitate to open a new one.
Thanks!
-
AuthorPosts
- The topic ‘Problems adding a facebook button to an event’ is closed to new replies.