Home › Forums › Calendar Products › Events Calendar PRO › link to previous website
- This topic has 10 replies, 3 voices, and was last updated 9 years, 1 month ago by
Cliff.
-
AuthorPosts
-
March 19, 2017 at 6:57 am #1256453
Hans-Gerd
ParticipantHi,
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&submitI 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( '« ' . esc_html_x( 'All %s (voheriger Link)', '%s Events plural label', 'tribe-events-calendar-pro' ), $events_label_plural ); ?></a>Cheers,
Hans-GerdMarch 20, 2017 at 9:29 pm #1257039Cliff
MemberHi, 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.
March 20, 2017 at 10:24 pm #1257076Hans-Gerd
ParticipantThis reply is private.
March 21, 2017 at 4:52 am #1257195Hans-Gerd
ParticipantHi 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( '« ' . 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-GerdMarch 21, 2017 at 5:06 am #1257202Hans-Gerd
ParticipantHi 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-GerdMarch 21, 2017 at 3:28 pm #1257626Cliff
MemberHans-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.
March 21, 2017 at 10:23 pm #1257820Hans-Gerd
ParticipantHi 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-GerdMarch 23, 2017 at 7:57 am #1258655Cliff
MemberMaybe you could maybe benefit from one of these (third-party, not guaranteed or supported by us):
- https://wordpress.org/plugins/wp-back-button/
- https://css-tricks.com/snippets/javascript/go-back-button/
- https://www.w3schools.com/jsref/met_his_back.asp
Please let me know if maybe this is more along the lines of what you’re wanting.
March 23, 2017 at 8:13 am #1258673Hans-Gerd
ParticipantHi 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-GerdMarch 23, 2017 at 11:03 am #1258922Cliff
MemberSounds good. I’m glad you were able to find something that works for your needs.
-
AuthorPosts
- The topic ‘link to previous website’ is closed to new replies.
