How can I return to my view after clicking [detailslink]

By: Jack Evangelides | Asked: 07/22/2022
ForumsCategory: General questionsHow can I return to my view after clicking [detailslink]
Jack EvangelidesJack Evangelides asked 2 years ago
I have a view that uses [detailslink] to display more data. If my view is at example.com/my-view/ When I click the details link it becomes example.com/my-view/entry/557 Is there a shortcode to then return to the original view (before clicking the [detailslink])?  
  1. I can't just use the original URL because I want to use the view on multiple pages
  2. I tried injecting js to return back to previous window, but this often gets removed (probably due to security reasons)
Bobby Clapp replied 2 years ago

Victor's suggestion is the most appropriate. If you can do a little HTML/CSS code, you can create the link and use CSS to style it like a button. If you want something built in, your theme may have some built in shortcodes to create a button or you can add a plugin like this -> https://getshortcodes.com/docs/button/

2 Answers
Best Answer
Jack EvangelidesJack Evangelides answered 2 years ago
Hi all,    the issue has been resolved, using this href="[server param="HTTP_REFERER"]"   The above is the best route because I can then use the view on multiple pages with different URLs, unlike with Victor's answer, I would only be able to use the view on 1 page due to the static link used. 
Bobby Clapp replied 2 years ago

Good self diagnosis. It wasn't apparent to me that is how you had it working, but we're glad you figured it out.

Victor Font answered 2 years ago
You can just add a link back to the view page. Let's say the view is shown on a page called /mydomain/my-view-page/. On the detail page, add a link with the href="/my-view-page/. There's no reason to do anything with jQuery/JavaScript here.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right