Skip Navigation

[Resolved] Bootstrap Collapse – expand first post

This support ticket is created 6 years 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by David Gimenez 6 years ago.

Assisted by: Luo Yang.

Author
Posts
#1134476

Link to documentation page: https://toolset.com/documentation/user-guides/digging-into-view-outputs/#bootstrap-collapse-expand-first-post

This code doesn't work.
The last tag must be </div>. However it doesn't work if I change it.

#1134825

Hi,

You are right, it is broken, I will escalate it, please try below example codes, and check if it works in your website:

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<div class="panel-group" id="accordion2" role="tablist" aria-multiselectable="true">
    <wpv-loop>
        [wpv-item index=1]
        <div class="panel panel-default">
    		<div class="panel-heading" role="tab" id="heading-[wpv-post-id]">
      			<h4 class="panel-title">
               	<a role="button" data-toggle="collapse" data-parent="#accordion2" href="#collapse-[wpv-post-id]" aria-expanded="true" aria-controls="collapse-[wpv-post-id]">
                    [wpv-post-title]
                </a>
              </h4>
            </div>
            <div id="collapse-[wpv-post-id]" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading-[wpv-post-id]">
      			<div class="panel-body">
                 [wpv-post-body view_template="None"]
            </div>
       </div>
        [wpv-item index=other]
        <div class="panel panel-default">
    		<div class="panel-heading" role="tab" id="heading-[wpv-post-id]">
      			<h4 class="panel-title">
                <a role="button" data-toggle="collapse" data-parent="#accordion2" href="#collapse-[wpv-post-id]" aria-expanded="false" aria-controls="collapse-[wpv-post-id]" class="collapsed">
                  [wpv-post-title]
                </a>
              </h4>
            </div>
            <div id="collapse-[wpv-post-id]" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-[wpv-post-id]">
      			<div class="panel-body">
                  [wpv-post-body view_template="None"]
            </div>
       </div>    
    </wpv-loop>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found][wpml-string context="wpv-views"]<strong>No posts found</strong>[/wpml-string][/wpv-no-items-found]
[wpv-layout-end]

More help:
hidden link

#1135491

Hi Luo. Thanks for your answer.

That code doesn't work. I think that there is a missing tag.

However I found the solution.

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<div class="accordion" id="accordion2">
    <wpv-loop>
        [wpv-item index=1]
       <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="#accordion2" href="#collapse-[wpv-post-id]">[types field="servei-del-negoci"][/types]</a>
                </h4>
            </div>
            <div id="collapse-[wpv-post-id]" class="panel-collapse collapse in">
                <div class="panel-body">
                   [types field='descripcio-servei-negoci'][/types]
                </div>
            </div>
        </div>
        [wpv-item index=other]  
       <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="#accordion2" href="#collapse-[wpv-post-id]">[types field="servei-del-negoci"][/types]</a>
                </h4>
            </div>
            <div id="collapse-[wpv-post-id]" class="panel-collapse collapse">
                <div class="panel-body">
                   [types field='descripcio-servei-negoci'][/types]
                </div>
            </div>
        </div>    
    </wpv-loop>
  </div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found][wpml-string context="wpv-views"]<strong>No posts found</strong>[/wpml-string][/wpv-no-items-found]
[wpv-layout-end]
#1135675

My issue is resolved now. Thank you!