Home › Forums › Calendar Products › Events Calendar PRO › Help with making website url a button
- This topic has 10 replies, 4 voices, and was last updated 9 years, 4 months ago by
Mark Earl.
-
AuthorPosts
-
December 7, 2016 at 7:35 am #1202606
Mark Earl
ParticipantFollowing the guide here:
https://theeventscalendar.com/knowledgebase/url-as-word-button/We want to change the website from a url to button for event website, organizer, and venue. We came up with this:
//Change Event URL to linked word instead of showing long URL
add_filter(‘tribe_get_event_website_link_label’, ‘tribe_get_event_website_link_label_default’);function tribe_get_event_website_link_label_default ($label) {
if( $label == tribe_get_event_website_url() ) {
$label = “Visit Website »”;
}return ‘‘ . $label . ‘ ‘;
}//Change Organizer URL to linked word instead of showing long URL
add_filter(‘tribe_get_organizer_website_link_label’, ‘tribe_get_organizer_website_link_label_default’);function tribe_get_organizer_website_link_label_default ($label) {
if( $label == tribe_get_organizer_website_url() ) {
$label = “Visit Website »”;
}return ‘‘ . $label . ‘ ‘;
}//Change Venue URL to linked word instead of showing long URL
add_filter(‘tribe_get_venue_website_link_label’, ‘tribe_get_venue_website_link_label_default’);function tribe_get_venue_website_link_label_default ($label) {
if( $label == tribe_get_venue_website_url() ) {
$label = “Visit Website »”;
}return ‘‘ . $label . ‘ ‘;
}This doesn’t not seem to be working.
December 7, 2016 at 7:45 am #1202616Mark Earl
ParticipantI saw some issues with my code above. Here is my revised code:
//Change Event URL to button
add_filter(‘tribe_get_event_website_link_label’, ‘tribe_get_event_website_link_label_default’);function tribe_get_event_website_link_label_default ($label) {
if( $label == tribe_get_event_website_url() ) {
$label = “Visit Website »”;
$class = “my-button-class”;
}return ‘‘ . $label . ‘ ‘;
}//Change Organizer URL to button
add_filter(‘tribe_get_organizer_website_link_label’, ‘tribe_get_organizer_website_link_label_default’);function tribe_get_organizer_website_link_label_default ($label) {
if( $label == tribe_get_organizer_website_url() ) {
$label = “Visit Website »”;
$class = “my-button-class”;
}return ‘‘ . $label . ‘ ‘;
}//Change Venue URL to button
add_filter(‘tribe_get_venue_website_link_label’, ‘tribe_get_venue_website_link_label_default’);function tribe_get_venue_website_link_label_default ($label) {
if( $label == tribe_get_venue_website_url() ) {
$label = “Visit Website »”;
$class = “my-button-class”;
}return ‘‘ . $label . ‘ ‘;
}Still does not work, though.
December 7, 2016 at 7:54 am #1202626Mark Earl
ParticipantIt wasn’t posting everything above correctly, so it should now here:
//Change Event URL to button add_filter('tribe_get_event_website_link_label', 'tribe_get_event_website_link_label_default'); function tribe_get_event_website_link_label_default ($label) { if( $label == tribe_get_event_website_url() ) { $label = "Visit Website »"; $class = "event-website-button-class"; } return '<a class="' . $class . '" href="' . tribe_get_event_website_url() . '">' . $label . ' </a>'; } //Change Organizer URL to button add_filter('tribe_get_organizer_website_link_label', 'tribe_get_organizer_website_link_label_default'); function tribe_get_organizer_website_link_label_default ($label) { if( $label == tribe_get_organizer_website_url() ) { $label = "Visit Website »"; $class = "event-website-button-class"; } return '<a class="' . $class . '" href="' . tribe_get_organizer_website_url() . '">' . $label . ' </a>'; } //Change Venue URL to button add_filter('tribe_get_venue_website_link_label', 'tribe_get_venue_website_link_label_default'); function tribe_get_venue_website_link_label_default ($label) { if( $label == tribe_get_venue_website_url() ) { $label = "Visit Website »"; $class = "event-website-button-class"; } return '<a class="' . $class . '" href="' . tribe_get_venue_website_url() . '">' . $label . ' </a>'; }-
This reply was modified 9 years, 4 months ago by
Mark Earl.
December 7, 2016 at 9:32 pm #1202982Geoff B.
MemberGood evening Mark and welcome back!
Thank you for reaching out to us.
I would love to help you with this topic.Just to set expectations, the scope of our support is mostly to get our customers started on the right track and to help them in case of issues.
We unfortunately do not provide complete support for customization.
With that in mind, I have requested that some of our code wizards take a look at your code in order to point you in the right direction towards a code that works for you 🙂
Hang in there as I follow-up on this for you.
Best regards,
Geoff B.
December 9, 2016 at 7:17 am #1203810Mark Earl
ParticipantAny update?
I was just using mostly code made originally available by you guy’s on your site. But doesn’t appear to be working.
December 9, 2016 at 11:55 pm #1204318Geoff B.
MemberHey Mark,
Sorry for the delay.
Our wizards have been pretty hard to get a hold of, but I should be able to give you an answer on Monday.
Hang in there!
Have a good week-end,
Geoff B.
December 14, 2016 at 2:12 pm #1206156Nico
MemberHey Mark,
Thanks for the patience while we worked on this! We’ve been indeed pretty busy these past weeks.
The code you shared, it’s actually working, you just needed to add the CSS to your theme stylesheet to make it look like a button. Anyway I made a shorter version of the code:
// Change Event URL to button
add_filter('tribe_get_event_website_link', 'tribe_custom_event_website_link');function tribe_custom_event_website_link ($link) {
if ( !empty($link) ) $link = 'Visit Website »';
return $link;
}// Change Organizer URL to button
add_filter('tribe_get_organizer_website_link', 'tribe_custom_organizer_website_link');function tribe_custom_organizer_website_link ($link) {
if ( !empty($link) ) $link = 'Visit Website »';
return $link;
}//Change Venue URL to button
add_filter('tribe_get_venue_website_link', 'tribe_custom_venue_website_link');function tribe_custom_venue_website_link ($link) {
if ( !empty($link) ) $link = 'Visit Website »';
return $link;
}
Replace your old code with the one above in your theme’s (or child theme’s) functions.php file and add the code blow to your theme stylesheet or via Simple Custom CSS plugin:
.website-button {
background-color: red;
color: #fff;
float: left;
margin-top: 10px;
padding: 10px;
}
Please give this a try and let us know if it works for you,
Best,
NicoDecember 14, 2016 at 2:19 pm #1206165Mark Earl
ParticipantThat new code is making Visit Website appear and work properly, but even with the css it is not a button. I am not seeing anything with class in your new code?
December 15, 2016 at 12:07 pm #1206619Mark Earl
ParticipantI was able to do the class. So this issue is resolved! Thanks!
December 15, 2016 at 4:57 pm #1206846Geoff B.
MemberGood evening Mark,
This is awesome news!
Kudos on finally solving this.
You are welcome back in our support forums any time 🙂
For now, I am going to close this thread.
Have a great week!
Geoff B.
-
This reply was modified 9 years, 4 months ago by
-
AuthorPosts
- The topic ‘Help with making website url a button’ is closed to new replies.
