• Resolved Jeff Mann

    (@jeffreybmann)


    I’m using a custom template and sorting within grouped categories. The short code I’m using is:

    [connections_list template_name='staff-card-bio' category='10,11,12' order_by='id|SORT_ACS']

    Within the custom template I’m using the following code to call the bio with a link.

    <a href="#" onclick="$('#hidden').toggle('fast');">Read <?php echo $entry->getFirstName() ?>'s Bio</a>
    <div id="hidden" style="display: none;"><?php echo $entry->getBio() ?></div>

    The problem I’m having is that in all four profiles that appear, every ‘read bio’ link reveals or hides only the first profile and never the profile it’s paired with. What am I doing wrong?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Jeff Mann

    (@jeffreybmann)

    This is what I’m trying to do.

    https://3rivers4cities1heart.com/?page_id=2

    Plugin Author Steven

    (@shazahm1hotmailcom)

    You code is close the hidden id needs to be unique for each displayed entry. Something like this:

    <a href="#" onclick="$('#hidden<?php echo $entry->getId() ?').toggle('fast');">Read <?php echo $entry->getFirstName() ?>'s Bio</a>
    <div id="hidden-<?php echo $entry->getId() ?>" style="display: none;"><?php echo $entry->getBio() ?></div>

    This will only work if an entry is displayed once. If it shows twice on a page there will be a conflict. You might be better off using the php function uniqid().

    Thread Starter Jeff Mann

    (@jeffreybmann)

    And close, yet again. I found that onclick, it would expand the correct bio, but jump to the top of the page. This was the final code that I used that seemed to work properly!

    <a href="#-<?php echo $entry->getId() ?>" onclick="$('#hidden-<?php echo $entry->getId() ?>').toggle('fast');">Read <?php echo $entry->getFirstName() ?>'s Bio</a>
    <div id="hidden-<?php echo $entry->getId() ?>" style="display: none;"><?php echo $entry->getBio() ?></div>

    Thank you!

    Did you ever resolve this?

    Jeff: Suddenly, that code doesn’t work! Nothing happens when you click the link – and it was working fine.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Connections] How do you apply jquery .toggle to hide/reveal bios?’ is closed to new replies.