function fwp_homepage_redirect() {
?>
<script>
(function($) {
    $(function() {
        // replace the submit button's "onclick" handler
        $('.zknfltr .zktrng').attr('onclick', 'custom_redirect()');
        $('.zkninpnpdng').keypress(function(e) {
		    var keycode = (e.keyCode ? e.keyCode : e.which);
		    if (keycode == '13') {
		      custom_redirect();
		    }
		});
		
		// write small plugin for keypress enter detection
		$.fn.enterKey = function (fnc) {
		    return this.each(function () {
		        $(this).keypress(function (e) {
		            var keycode = (e.keyCode ? e.keyCode : e.which);
		            if (keycode == '13') {
		                fnc.call(this, e);
		            }
		        })
		    })
		}

    });
})(jQuery);
function custom_redirect() {
    FWP.parse_facets();
    FWP.set_hash();
    var query_string = FWP.build_query_string();
    if ('' != query_string) {
        query_string = '?' + query_string;
    }
    pagename = '/opleidingen/';
    window.location.href = pagename + query_string.replace("categoriehome", "training");
    window.location.href = pagename + query_string.replace("zoeken", "zoeken");
}
</script>
<?php
}
add_action( 'wp_head', 'fwp_homepage_redirect', 100 );

 

Geef een reactie 0