Skip Navigation

[Resolved] Clickable Divs with “index=1” and “index=other”

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to make an entire div clickable instead of just a single link inside that div.

Solution: Move the a tag so that it surrounds the entire div, and use CSS to style the links and text inside the div.

This support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by jorg-andreasK 7 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#577020

Hi there,...

I am using a loop, which works fine, with index =1 and index=other functionallity.

It is all used for standard WordPress post types.

The idea is to make each item in the loop clickable, targeting the depending post. I understand, that it has to be done by a div tag. But until now I could not realize it,... due to the correct spelling and usage of the a tag in it.

Here is my loop without anything for the clickable div:

<!-- wpv-loop-start -->
<wpv-loop>
[wpv-item index=1]
<div class="doppelspalter_wrapper">
<h2 class="dp-zweiteueberschrift">[types field='zweiteueberschrift'][/types]</h2>
<h2 class="dp_h2">[wpv-post-title]</h2>
<!-- Hier wird das Artikelbild verlinked -->
[wpv-post-featured-image size="custom" width="633" height="356" crop="true"]
<p class="dp_p"[types field='beitragsaufmacher'][/types]</p></div>
[wpv-item index=other]
<div class="postitem_wrapper_bl">
<div class="innen_wrapper_links_bl">
[wpv-post-featured-image size="custom" width="250" height="141" crop="true"]
</div>
<div class="innen_wrapper_rechts_bl">
<div class="zweite_ueberschrift_bl">[types field='zweiteueberschrift'][/types] </div>
<h2 class="h2class_bl">[wpv-post-link]</h2>
<span class="beitragsaufmacher_bl">[types field='beitragsaufmacher'][/types]</span>
</div>
</div>
</wpv-loop><!-- wpv-loop-end -->

I guess, I will need to put a a tag into the"doppelspalter_wrapper" div and another into "postitem_wrapper_bl". But how to achieve this in correct usage and spelling?

Thx

Jörg

#577122

Okay so if you want to make the entire div.doppelspalter_wrapper clickable, you can do this:

<!-- wpv-loop-start -->
<wpv-loop>
[wpv-item index=1]
<a href="[wpv-post-url]">
  <div class="doppelspalter_wrapper">
    <h2 class="dp-zweiteueberschrift">[types field='zweiteueberschrift'][/types]</h2>
    <h2 class="dp_h2">[wpv-post-title]</h2>
    <!-- Hier wird das Artikelbild verlinked -->
    [wpv-post-featured-image size="custom" width="633" height="356" crop="true"]
    <p class="dp_p"[types field='beitragsaufmacher'][/types]</p>
  </div>
</a>

Then you can use CSS to style the text inside the div to remove the default underline and styles, if you'd like. I can help with this if you can show me in a browser.

#577213

Hi Chris,...

Thank you very much - it works,....

Again,... You are my KING... 🙂

Jörg