On woocommerce storefront header, for not-logged users, I want to replace the search box area with 2 gold bootstrap buttons: "Login", "Register" (like the stackoverflow landing-page header), to send guests to my customized login/register urls. With your help I have this PHP and CSS snippets that work fine to hide the search box for no-logged users, but I don't know what to do next:
add_filter( 'body_class', 'add_body_class_for_guest' );
function add_body_class_for_guest( $classes ) {
// Only for non logged users
if( ! is_user_logged_in() ) {
$classes[] = 'not-logged';
}
return $classes;
}
CSS:
.not-logged .site-header .site-search { display: none; }
To replace Storefront search box by a button linked to Login / Register page, for unlogged users, you can use the following instead (so don't use your code and remove the CSS rule):
Code goes in functions.php file of the active child theme (or active theme). Tested and works.
You will get the following for guest users: