Skip Navigation

[Resolved] Add attributes to search elements

This support ticket is created 6 years, 7 months 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.

This topic contains 1 reply, has 2 voices.

Last updated by Ricardo Alday 6 years, 7 months ago.

Assisted by: Ricardo Alday.

Author
Posts
#680362

I am trying to: Add an ID to the search input and FOR to the label. But an example in one of the forums wasn't working.

Here is what I have:

<div class="forum-group">
<label>[wpml-string context="wpv-views" for="search-form"]SEARCH FORUMS[/wpml-string]</label>
<div class="forum-search-bar">[wpv-filter-search-box output="bootstrap" id="search-forums"][wpv-filter-submit type="button" output="bootstrap" class="forum-search-submit"]</div>
</div>

Let me know what I am doing wrong here.

Thanks.

#681498

Hi,

Thanks for contacting support. I'll do my best to help you with your question.

The wpml-string does not take any other parameters other than "context" and "name".
For more information check this link: https://toolset.com/documentation/user-guides/views-shortcodes/#vf-464327

You can add the "for" attribute to the "label" HTML element like so:
<label for="search-form">[wpml-string context="wpv-views"]SEARCH FORUMS[/wpml-string]
</label>

Similarly, the wpv-filter-search-box shortcode does not have attribute for ID but you can add it to the HTML button element:
<div class="forum-search-bar" id="search-forums">[wpv-filter-search-box output="bootstrap"][wpv-filter-submit type="button" output="bootstrap" class="forum-search-submit"]</div>
</div>

You can use the class attribute too instead of using an ID
<div class="forum-search-bar">[wpv-filter-search-box output="bootstrap" class="search-forums"][wpv-filter-submit type="button" output="bootstrap" class="forum-search-submit"]</div>
</div>

Hope that helps,
Ricardo