Skip Navigation

[Resolved] How to style the custom search form in Blocks editor

This thread is resolved. Here is a description of the problem and solution.

This thread was about styling Toolset elements. In the meantime, we published a full training course about designing WordPress sites. Check it out to learn how to style Toolset elements and your whole site.

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

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 18 replies, has 3 voices.

Last updated by jamesW-26 4 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#1715895

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Do you mean you want to pre-select any option from the month dropdown select filter?

#1715899

Yes that's correct. And I'll need to update it each month so that it display the current month. At this stage am happy to do it manually, just need a way to do it.

#1715901

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've added the following JS code to "Custom JS and CSS" tab of the view added on the following page:
=> hidden link

jQuery(document).ready(function($){

  var months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];;
  var current_date = new Date();
  
  month_year = months[current_date.getMonth()]+'-'+current_date.getFullYear()

    $("select[name='wpv-taxonomy-key-date-month'] option[value='"+month_year+"']").prop('selected', true).trigger('change');


});

I can see now the current month is automatically selected and it also filters the results.

#1716771

Thank you so much Minesh! That's sensational, works perfect! More than I expected 🙂

Much appreciated!
James