Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /** prepend selected value label of fselect with default value **/
- add_action( 'wp_footer', function() {
- ?>
- <script>
- (function($) {
- if ('object' !== typeof FWP) {
- return;
- }
- $(function() {
- FWP.hooks.addAction('facetwp/loaded', function() {
- $('.facetwp-type-fselect').each(function() {
- var facet_name = $(this).attr('data-name');
- var facet_label = $(this).find('.facetwp-dropdown > option:first-child').text();
- if ( 'undefined' !== typeof FWP.facets[facet_name] && FWP.facets[facet_name].length > 0 ) {
- $(this).find('.fs-label').prepend( facet_label + ': ' );
- }
- });
- }, 100 );
- });
- })(jQuery);
- </script>
- <?php
- }, 100 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement