Remove comma after venue title in tribe_get_venue_details

Home Forums Calendar Products Events Calendar PRO Remove comma after venue title in tribe_get_venue_details

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1421718
    inhouse
    Participant

    Hello, my previous thread was closed to new replies so I am creating a new thread. Feel free to merge if possible.

    I’m using the function tribe_get_venue_details to customize the venue details but I don’t see a way to remove the comma after the venue name. The design calls for the data to be stacked (block) as opposed to inline so the comma is redundant.

    I looked up the function tribe_get_venue but there’s no real documentation on how to modify the output.

    $venue_details[‘linked_name’] = tribe_get_venue();

    #1422746
    Crisoforo
    Keymaster

    Hey there thanks for reaching out.

    I’m looking at the two functions:

    • tribe_get_venue_details: returns an array with the venue name  as link and address.
    • tribe_get_venue: returns the name of the venue based on the ID of the event.

    Would you mind describing a little bit more what are you trying to get from each function or exactly what part are you trying to modify.

    Please let me know about this so we can provide a more clear guidance on your questions, and let me know if you have more questions about this.


    Thanks,
    Crisoforo

    #1427514
    inhouse
    Participant

    Hi Crisoforo. I am simply trying to remove the comma from the venue name. It’s not needed because the information is styled to be stacked rather than inline (see screenshot). My function is able to get the venue using tribe_get_venue() but I don’t know how to remove the comma.

    `

    function my_tribe_get_venue_details( $post_id = null ) {
    $post_id = Tribe__Main::post_id_helper( $post_id );

    if ( ! $post_id ) {
        return array();
    }
    
    $venue_details = array();
    
    if ( $venue_link = tribe_get_venue_link( $post_id ) ) {
        //$venue_details['linked_name'] = $venue_link;
        //$venue_name = tribe_get_venue($post_id);
        //return $venue_name;
        $venue_details['linked_name'] = tribe_get_venue();
    }
    
    if ( $venue_address = tribe_get_full_address( $post_id ) ) {
        $venue_details['address'] = $venue_address;
    }
    return apply_filters( 'tribe_get_venue_details', $venue_details, $post_id );
    

    }

    `

    • This reply was modified 8 years, 2 months ago by inhouse. Reason: Code is not styling properly for some reason
    #1427580
    Crisoforo
    Keymaster

    Hey!

    Thanks for your reply, based on the code you provided it seems like you are trying to remove the comma from the address? as the venue name does not have any comma added by the plugin. If that’s the case you can replace the following line of code with.

    $venue_details['address'] = str_replace( ',', '', $venue_address );

    This will remove any comma from the third parameter in the function, you can use this to remove comma for any other variable as well.

    Let me know if that helps and if you have any additional questions about this.

    Thanks,
    Crisoforo

    #1427610
    inhouse
    Participant

    I see what you’re trying to do there but it’s not the address I need to remove the address from. I need to remove the comma from the venue name. I tried implementing the strip_replace with tribe_get_venue but the comma is still not stripped out.

    $venue_name = tribe_get_venue();
    $venue_name_no_comma = str_replace( '', ',', $venue_name );
    $venue_details['linked_name'] = $venue_name_no_comma;

    #1427670
    Crisoforo
    Keymaster

    Let see what’s going on here, would you mind adding this line of code and sharing the output so we can see the problem.

    var_dump( tribe_get_venue() );

    Add this and this will generate another output to inspect the value of the variable, let me know once you have it so we can move forward with this one.

    Thanks,
    Crisoforo

    #1427802
    inhouse
    Participant

    I see string(24) “Geneva Housing Authority” which tells me the commas are being added in the template itself; not the function. I removed the comma in the $address_delimiter variable and this solved it! Thanks so much for your help in troubleshooting this!

    `
    $address_delimiter = empty( $venue_address ) ? ‘ ‘ : ‘, ‘;

    // These details are already escaped in various ways earlier in the process.
    echo implode( $address_delimiter, $venue_details );

    if ( tribe_get_map_link() ) {
    echo tribe_get_map_link_html();
    }

    `

    Change to:
    $address_delimiter = empty( $venue_address ) ? ' ' : ', ';

    • This reply was modified 8 years, 2 months ago by inhouse. Reason: Code will not always format properly with this support thread software
    #1427847
    Crisoforo
    Keymaster

    That’s excellent!

    Feel free to reach out in the future if you have more questions about this topic or anything related with our plugins.

    Have a great day.

    Thanks,
    Crisoforo

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Remove comma after venue title in tribe_get_venue_details’ is closed to new replies.