Hi,
I'd like to use an index in the output of a view.
What I need is a button with a label that says "Video of week 1", "Video of week 2" and so on...
Though it's not documented, I found out the shortcode [wpv-index], but that doesn't work (just outputs the shortcode). I tried both directly in the loop and in a content template.
Here's my current code:
<div class=" ubtn-ctn-left btnWArrow"><a class="ubtn-link ult-adjust-bottom-margin ubtn-left ubtn-normal btnWArrow wplightbox" href="[types field='video' output='raw'][/types]" target=""><button type="button" id="ubtn-8984" class="ubtn ult-adjust-bottom-margin ult-responsive ubtn-normal ubtn-no-hover-bg none ubtn-sep-icon ubtn-sep-icon-at-right ubtn-left tooltip-58a4c64a75d04" data-hover="" data-border-color="" data-bg="#6caddf" data-hover-bg="" data-border-hover="" data-shadow-hover="" data-shadow-click="none" data-shadow="" data-shd-shadow="" data-ultimate-target="#ubtn-8984" data-responsive-json-new="{"font-size":"desktop:14px;","line-height":""}" style="font-family:'Open Sans';font-weight:700;border:none;background: #6caddf;color: #ffffff;"><span class="ubtn-data ubtn-icon"><i class="Defaults-long-arrow-right" style="font-size:25px;color:#ffffff;"></span><span class="ubtn-hover" style="background-color:"></span><span class="ubtn-data ubtn-text ">VIDEO SEMAINE [wpv-index]</span></button></a></div>
Is there another way to get the index, or is something wrong in my code?
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
Well - to display loop output index you need to use the custom shortcode to display the index.
For example - add following code to your current thee's functions.php file:
add_shortcode('incrementor', 'incrementor');
function incrementor() {
static $i = 1;
return $i ++;
}
And use the shortcode as:
VIDEO SEMAINE [incrementor]
Thanks a lot! Works like a charm!