mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-01 11:52:25 +08:00
47 lines
1.1 KiB
Text
47 lines
1.1 KiB
Text
add_filter('generate_navigation_search_output', function ($html) {
|
|
|
|
$html = '<div class="search-form navigation-search">';
|
|
$html .= do_shortcode('[wcas-search-form]');
|
|
$html .= '</div>';
|
|
|
|
return $html;
|
|
}, 10, 1);
|
|
|
|
add_action('wp_head', function () {
|
|
?>
|
|
<style>
|
|
.navigation-search .dgwt-wcas-search-form {
|
|
margin-top: 10px;
|
|
}
|
|
|
|
.navigation-search {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
flex-direction: row;
|
|
}
|
|
|
|
.navigation-search .dgwt-wcas-search-wrapp {
|
|
margin: 0;
|
|
max-width: 600px;
|
|
margin-right: 52px;
|
|
}
|
|
|
|
</style>
|
|
<?php
|
|
});
|
|
|
|
add_action('wp_footer', function () {
|
|
?>
|
|
<script>
|
|
jQuery(document).ready(function ($) {
|
|
|
|
$('.menu .search-item:not(.active)').on('click', function () {
|
|
var $input = $('.navigation-search .dgwt-wcas-search-input');
|
|
if ($input.length > 0) {
|
|
$input.focus();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
<?php
|
|
});
|