Hi support team,
I've designed a view that queries a custom post type and I have done some CSS styling to make the results more interactive. Now what I would really love is for these results to be clickable and link to the post. So instead of just the post title in the loop you can click anywhere in the loop item. I have linked a screencap of the page or see it in action here: hidden link
Is there an easy way of doing this? Is it possible to wrap the loop item in
tags?
Thanks,
Rens
Hello,
I suggest you try these:
1) Edit the the post view you mentioned in the screenshot:
https://toolset.com/wp-content/uploads/2020/01/1441175-div_hyperlink.png
2) In section "View loop", add a content template block,
3) In the content template block, wrap all contents into HTML a tag.
Thanks Luo, I will try that and let you know.
Rens
And there is a simple workaround:
You can add two HTML blocks, setup the HTML links, for example:
<a href="[wpv-post-url]">
Use them to wrap other blocks/contents, see screenshot:
https://toolset.com/wp-content/uploads/2020/01/1443831-link1.jpg
Thanks you, I will try it tonight and let you know! 😉
Rens
OK, please update here if you need more assistance for it.
For anyone interested, it's been a while but I got this to work.
Placing the <a> tag around the other blocks/contents did not work. The closing tag was always moved to right after the opening tag.
How did I do it then? I found this video on YouTube: hidden link
I added the Jquery code inside the actual view loop block (inside a custom HTML block, enclosed in <script> ---Jquery here--- </script>.
<script>
jQuery(".CSSCLASS").click(function() {
window.location = "[wpv-post-url]";
});
</script>