Function to Change Venue Website URL

Home Forums Calendar Products Community Events Function to Change Venue Website URL

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1053615
    Sean
    Participant

    Hi,

    Using your tutorial as a starting point, I’ve used a similar snippet to successfully change my Organizer Website’s to buttons:

     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 = "Organizer Website";
    		$class = "tribe-events-button";
    	}
    
    	return '<a class="' . $class . '" href="' . tribe_get_organizer_website_url() . '" target="_blank">' . $label . '</a>';
    }

    However, I’ve been unsuccessful in changing the Venue Website’s to buttons. I tried using tribe_get_venue_website_link but that doesn’t seem to be the correct function, as the pages fail to load with that added to my functions.php.

    Is there a filter/function that should be used to change the Venue Website URL to a label/button? Likewise, is anything available that can be used to change these to labels/buttons:

    1) A PRO Additional Field (that is set as a URL field type)
    2) Organizer Email

    Thank you.

    #1054308
    Geoff B.
    Member

    Good evening Karly,

     

    Congrats on successfully changing your organizer’s URLs to buttons.

    It does seem indeed that the correct function to use is tribe_get_venue_website_link. Normally, it should work if you used a similar approach.Perhaps there is something missing from your custom function ?

    If you don’t mind, the fastest way to get to the bottom of this would be if you could share the code for the function you did with tribe_get_venue_website_link.

    On that topic, if you haven’t already, I highly recommend reading my colleague George’s great post on a similar question.

    Is there a filter/function that should be used to change the Venue Website URL to a label/button? Likewise, is anything available that can be used to change these to labels/buttons:

    1) A PRO Additional Field (that is set as a URL field type)

    Yes, again I recommend reading more of George’s great work on that very topic.

    2) Organizer Email

    Yes, the function you are looking for can be found here.

    Let me know if you have any follow-up questions.

    Have a great day,

    Geoff B.

     

    #1054853
    Sean
    Participant

    This reply is private.

    #1055543
    Geoff B.
    Member

    Good afternoon Karly,

    To answer your questions I:

    • Gave a quick glance at your functions and I could not find anything wrong with the way they are written per se
    • Did a copy-paste of all of your custom functions in the functions.php file of my Twenty-Fifteen child theme and did not get a 502 Bad gateway error.

    That being said. Here are a couple of pointers to get you moving forward:

    1. I would recommend testing your function calls to see what they return (using echo) prior to attempting to modify their content. For example, if you look carefully at the parameters supported by the tribe_get_venue_website_link function, you will notice that $label is supported. However, that is not the case for tribe_get_organizer_email function. That means that you would need to adjust your code to work around that.
    2. As far as the 502 Bad gateway error is concerned, perhaps it’s a simple matter of flushing your permalinks ? (resaving them)

    Let me know if that helps.

    Have a wonderful day!

    Geoff B.

    #1056321
    Sean
    Participant

    Hi Geoff,

    Thanks so much for looking these over. It’s good to hear that these appear to be written correctly. Unfortuantely I’m stumped as to why the function for changing the Venue Website to a button is resulting in a 502 Gateway error. For single events that don’t have a venue website url those pages load fine, but for some reason the events that do have a venue website are returning the error. I’ll need to do some more digging or look into having a freelancer troubleshoot further, but did want to thank you for your suggestions.

    Regards,
    Karly

    #1056844
    Geoff B.
    Member

    Good evening Karly,

    Thank you for your feedback and kudos on your efforts to become a WordPress code ninja 🙂

    Is there anything else I can help you with on this topic ?

    Have a great evening,

    Geoff B.

     

     

    #1056877
    Sean
    Participant

    Thanks Geoff. At this point I’m just trying to figure out why the functions aren’t working (which I understand is outside the scope of support provided here)

    #1056894
    Geoff B.
    Member

    Thank you for your reply Karly.

    In that case, I will close this thread.

    But you are always welcome in the support forums.

    Have a great weekend,

    Geoff B.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Function to Change Venue Website URL’ is closed to new replies.