How to create an universal url from single layout to archive layout

Hi

I’ve created three different post types with ACF. And on the single layouts I have a return-button to the parent archive. This button uses a static url to the archive e.g. sitename.com/archive-name

Now to my problem: I am going to translate the site to at least 3 different languages with WPML. How can I make the “return to parent archive button” to work seamlessly every time without having to enter different url’s on every single layout? It would be nice to have an universal button for bringing the user back to previous page (archive).

Best Regards
Bengt

Hello @CyberBengt,

Thanks for writing in!

You can create a button, and in the link URL, you can insert “javascript:history.back()”.

This should allow the user to always go back to the previous page. So, if the user is viewing the parent archive, as soon as he clicks on one item in the archive, upon viewing the single item page, he can go back to the previous page.

Hope this makes sense.

1 Like

Yes @ruenel
This was the solution I was looking for.

Thank’s agin for your help!

Best Regards
Bengt

You’re welcome, Bengt.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.