Hello Guys.
Im currently using the following code to output my nav.
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<ul id="main-nav" class="nav navbar-nav menu">
<wpv-loop>
<li [wpv-if evaluate="[wpv-post-id]=[wpv-post-id id="$current_page"]"]class="active"[/wpv-if] >
<a href='[wpv-post-url]'>
[wpv-post-title]
</a>
<div class="active-marker">
<div class="left"></div>
<div class="center"></div>
<div class="right"></div>
</div>
</li>
</wpv-loop>
</ul>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
Problem is, the "active" class doesnt get added to the li item that is the current page item..
The REAL problem is in fact, that it does, but only some times (not knowing why and what makes it show only sometimes).. If it did not show at all, i would think it has something to do with the code, but since SOMETIMES it does, i really have a hard time knowing what it is..
The shortcode is not added to in the loop (of the template), but its added in header.php
I wanted to provide debug info, but could not find it anywhere since the ui/structure has been changed multiple times in the latest updates.
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
We have replaced [wpv-if] shortcode with [wpv-conditional] shortcode.
There is a detailed documentation regarding conditional output. Could you please go through the following Doc and try to resolve your issue.
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
Hi Minesh.
I tried updating the code, it works but the issue still persists. Im getting very sure this is a bug.
New code:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<ul id="main-nav" class="nav navbar-nav menu">
<wpv-loop>
[wpv-conditional if="(empty($(wpcf-skjul-i-menu)) )"]
<li [wpv-conditional if="[wpv-post-id]=[wpv-post-id id="$current_page"]"]class="active"[/wpv-conditional]>
<a href='[wpv-post-url]'>
[wpv-conditional if="(NOT empty($(wpcf-menu-ikon)) )"]
<img src='[types field="menu-ikon" output="raw"][/types]' class="menu-ikon" />
[/wpv-conditional]
[wpv-post-title]
</a>
<div class="active-marker">
<div class="left"></div>
<div class="center"></div>
<div class="right"></div>
</div>
</li>
[/wpv-conditional]
</wpv-loop>
</ul>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
It still does not add the class to the correct page.
I found the solution.
The code has been updated again.
For others who might experience the same issue, here it is:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<ul id="main-nav" class="nav navbar-nav menu">
<wpv-loop>
[wpv-conditional if="(empty($(wpcf-skjul-i-menu)) )"]
<li [wpv-conditional if="( '[wpv-post-id]' eq '[wpv-post-id id="$current_page"]' )"]class="active"[/wpv-conditional]>
<a href='[wpv-post-url]'>
[wpv-conditional if="(NOT empty($(wpcf-menu-ikon)) )"]
<img src='[types field="menu-ikon" output="raw"][/types]' class="menu-ikon" />
[/wpv-conditional]
[wpv-post-title]
</a>
<div class="active-marker">
<div class="left"></div>
<div class="center"></div>
<div class="right"></div>
</div>
</li>
[/wpv-conditional]
</wpv-loop>
</ul>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]