Skip to content

Instantly share code, notes, and snippets.

@thegulshankumar
Created January 28, 2020 23:11
Show Gist options
  • Save thegulshankumar/06d073eaa982df4e172e7305d7c06b8e to your computer and use it in GitHub Desktop.
Save thegulshankumar/06d073eaa982df4e172e7305d7c06b8e to your computer and use it in GitHub Desktop.
GeneratePress CSE Config
// Change Search path in the GeneratePress Theme
add_filter( 'generate_navigation_search_output', function() {
printf(
'<form method="get" class="search-form navigation-search" action="%1$s">
<input type="search" placeholder=" Search" class="search-field" value="%2$s" name="q" title="%3$s" />
</form>',
esc_url( home_url( '/search/' ) ),
esc_attr( get_search_query() ),
esc_attr_x( 'Search', 'label', 'generatepress' )
);
} );
// Change JSON-LD path
function yst_change_json_ld_search_url() {
return trailingslashit( home_url() ) . 'search/?q={search_term_string}';
}
add_filter( 'wpseo_json_ld_search_url', 'yst_change_json_ld_search_url' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment