Skip to content

Instantly share code, notes, and snippets.

@manhleo93 manhleo93/js
Created Sep 18, 2018

Embed
What would you like to do?
JS
# Thêm biểu tượng vào themes
wp_enqueue_style(
'monochrome-ionicons', '//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css',
array(),
CHILD_THEME_VERSION
);
# Thêm js vào themes
wp_enqueue_script( 'genesis-sample', CHILD_URL . '/js/genesis-sample.js', array( 'jquery' ), '1.0.0', true );
# Thêm khung tìm kiếm
add_action( 'genesis_header', 'custom_get_header_search_toggle' );
/**
* Outputs the header search form toggle button.
*/
function custom_get_header_search_toggle() {
printf(
'<a href="#header-search-wrap" aria-controls="header-search-wrap" aria-expanded="false" role="button" class="toggle-header-search"><span class="screen-reader-text">%s</span><span class="ionicons ion-ios-search"></span></a>',
__( 'Show Search', 'genesis-sample' )
);
}
add_action( 'genesis_header', 'custom_do_header_search_form' );
/**
* Outputs the header search form.
*/
function custom_do_header_search_form() {
$button = sprintf(
'<a href="#" role="button" aria-expanded="false" aria-controls="header-search-wrap" class="toggle-header-search close"><span class="screen-reader-text">%s</span><span class="ionicons ion-ios-close-empty"></span></a>',
__( 'Hide Search', 'genesis-sample' )
);
printf(
'<div id="header-search-wrap" class="header-search-wrap">%s %s</div>',
get_search_form( false ),
$button
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.