eo_get_venue_link($venue_id) function returns an error

WordPress Event Management, Calendars & Registration Forums Report A Bug eo_get_venue_link($venue_id) function returns an error

This topic contains 4 replies, has 2 voices, and was last updated by  haleeben 11 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5319

    Hey Stephen

    Not sure if it’s a bug or something I’ve done but when I use the eo_get_venue_link($venue_id); function it returns the url with an Object error

    http://sncc.ebenhale.com/events/venues/sncc/WP_Error Object ( [errors] => Array ( [invalid_term] => Array ( [0] => Empty Term ) ) [error_data] => Array ( ) )

    I’ve used the function in a custom shortcode and it works fine.

    haleeben
    #5320

    In what context are you using this – is it after the init hook (priority 10)?

    Stephen Harris
    #5321

    No I’m just using it in a page template. I’m using the eo_get_events() function to get the events and then using the eo_get_venue_link() function to get the venue link.

    haleeben
    #5322

    If you’re using it outside the loop you’ll need to provide the venue ID (integer) or slug (string). E.g.

      $venue_id = eo_get_venue( $event->ID );
      $link = eo_get_venue_link( $venue_id );
    
    Stephen Harris
    #5323

    Hey Stephen

    I just realised that I wasn’t checking to see if the event had a venue ( some of them didn’t ) add it gave the error.

    I added a if( $venue_id = eo_get_venue($event->ID) ){ then the venue code here }

    and it fixed the problem.

    Thanks

    haleeben
Viewing 5 posts - 1 through 5 (of 5 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.