Help with making website url a button

Home Forums Calendar Products Events Calendar PRO Help with making website url a button

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1202606
    Mark Earl
    Participant

    Following 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.

    #1202616
    Mark Earl
    Participant

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

    #1202626
    Mark Earl
    Participant

    It 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 &raquo;";
    	$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 &raquo;";
    	$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.
    #1202982
    Geoff B.
    Member

    Good 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.

     

    #1203810
    Mark Earl
    Participant

    Any update?

    I was just using mostly code made originally available by you guy’s on your site. But doesn’t appear to be working.

    #1204318
    Geoff B.
    Member

    Hey 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.

    #1206156
    Nico
    Member

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

    #1206165
    Mark Earl
    Participant

    That 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?

    #1206619
    Mark Earl
    Participant

    I was able to do the class. So this issue is resolved! Thanks!

    #1206846
    Geoff B.
    Member

    Good 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.

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Help with making website url a button’ is closed to new replies.