Individual Link shortcode entry

This topic contains 2 replies, has 2 voices, and was last updated by  Stephen Harris 11 months, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #42788

    I show the events of the day via this shortcode:

    [eo_events ondate=now]

    How do I link each entry to an individual url?

    I did a similar think with the calender entries, so the events already have a custom url attached.

    https://wp-event-organiser.com/forums/topic/point-entry-to-individual-page/#post-42785

    Fabienne Freymadl
    #42789

    Maybe a better question:

    is there a way to make it so that I change all the event links to an individual url that I attach via custom field ‘kalendertag_link’ to an event, if an event exists?

    That would make my life much easier.

    Fabienne Freymadl
    #42811

    Hi Fabienne,

    I’ve not tried this, but WordPress passes all post type links through the filter post_type_link. So something like:

    add_filter('post_type_link', function( $post_link, $post, $leavename, $sample){
        if(get_post_type($post) != "eo_event" || $sample ) {
           return $post_link
       }
    
      $custom_link = get_post_meta($post->ID, 'kalendertag_link', true);
    
      return $custom_link ? $custom_link : $post_link;
    }, 10, 4);
    
    Stephen Harris
Viewing 3 posts - 1 through 3 (of 3 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.