link to previous website

Home Forums Calendar Products Events Calendar PRO link to previous website

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1256453
    Hans-Gerd
    Participant

    Hi,
    is there a function, which give me back the link to the previous website ?
    For example:
    List view of events with a special category.
    When showing a single event, there is the link “all events”.
    Here I want to link to the previous list view.

    I didn’t find a function like that in
    https://theeventscalendar.com/page/1/?s=link&post_type%5B0%5D=documentation&submit

    I tried tribe_get_listview_dir_link() in single-event.php, but there is not shown the previous view:

    
    $vorherige_seite = tribe_get_listview_dir_link();
    ...
        <a href="<?php echo esc_url( $vorherige_seite ); ?>"> <?php printf( '&laquo; ' . esc_html_x( 'All %s (voheriger Link)', '%s Events plural label', 'tribe-events-calendar-pro' ), $events_label_plural ); ?></a>
    

    Cheers,
    Hans-Gerd

    • This topic was modified 9 years, 1 month ago by Hans-Gerd. Reason: tribe_get_listview_dir_link()
    • This topic was modified 9 years, 1 month ago by Cliff.
    #1257039
    Cliff
    Member

    Hi, Hans-Gerd.

    I’m not 100% clear exactly what you’re referring to by “previous website” in your first sentence. If you share an annotated screenshot or video screen capture, it might help communicate what you’re seeing and what exactly you’re wanting.

    #1257076
    Hans-Gerd
    Participant

    This reply is private.

    #1257195
    Hans-Gerd
    Participant

    Hi Cliff,
    this seem to work fine:

    // $vorherige_seite = tribe_get_listview_dir_link();
    $vorherige_seite = $_SERVER["HTTP_REFERER"];
    ?>
    <div id="tribe-events-content" class="tribe-events-single">
    	<p class="tribe-events-back">
        <a href="<?php echo esc_url( $vorherige_seite ); ?>"> <?php printf( '&laquo; ' . esc_html_x( 'All %s (voheriger Link)', '%s Events plural label', 'tribe-events-calendar-pro' ), $events_label_plural ); ?></a>
    ...
    

    … or do you see an issue when using $_SERVER[“HTTP_REFERER”] ?

    Cheers,
    Hans-Gerd

    #1257202
    Hans-Gerd
    Participant

    Hi Cliff,
    that seem to be a better solution because using a function of the wordpress codex:

    
    // $vorherige_seite = $_SERVER["HTTP_REFERER"];
    $vorherige_seite = wp_get_referer();
    

    see here: https://codex.wordpress.org/Function_Reference/wp_get_referer

    May be thats a general improvement for single-events.php ?

    Cheers,
    Hans-Gerd

    #1257626
    Cliff
    Member

    Hans-Gerd,

    Here’s my understanding of your request:

    If your site’s default calendar view is Month and a user is at a different calendar view (e.g. Photo) and they click to view a single event and then click the All Events link, you want to take them back to Photo instead of Month view.

    I think your implementation of using the referrer is fine. However, you should make sure to account for a situation like this: click from single event A to single event B -> don’t want the referrer (event A) to be the URL you send them to if they click All Events from event B.

    Please let me know if you have any follow-up questions on this topic.

    #1257820
    Hans-Gerd
    Participant

    Hi Cliff,
    thanks for answer and patience.

    If your site’s default calendar view is Month and a user is at a different calendar view (e.g. Photo) and they click to view a single event and then click the All Events link, you want to take them back to Photo instead of Month view.

    no, I want to implement an option like the “go back” – icon of the browser (firefox, IE, etc.)

    My solution doesn’t make issues in the kind described by you, because it is not possible to click from event A immediately to event B.

    Cheers,
    Hans-Gerd

    #1258655
    Cliff
    Member

    Maybe you could maybe benefit from one of these (third-party, not guaranteed or supported by us):

    Please let me know if maybe this is more along the lines of what you’re wanting.

    #1258673
    Hans-Gerd
    Participant

    Hi Cliff,
    thanks for information.

    Until there are only minor issues with the solution I declared (wp_get_referer()), I don’t need another plugin for this.

    Cheers,
    Hans-Gerd

    #1258922
    Cliff
    Member

    Sounds good. I’m glad you were able to find something that works for your needs.

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘link to previous website’ is closed to new replies.