Skip to content

Instantly share code, notes, and snippets.

@manhleo93
Created September 18, 2018 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manhleo93/1a7f20c94161ff8f2d2f7d8a6b1ccab3 to your computer and use it in GitHub Desktop.
Save manhleo93/1a7f20c94161ff8f2d2f7d8a6b1ccab3 to your computer and use it in GitHub Desktop.
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