New Landing How can we help? Themeforest Theme Support Nota Limit "mobile search" on products, not on all content

Viewing 4 posts - 1 through 4 (of 4 total)
  • Posted in: Nota
  • #298062
    Stonedb
    Member
    Post count: 34

    Hi all,

    first sorry for my bad english, i hope you’ll understand.

    Mbile search in sidebar search in all content (blog post, product, …). I would like change it to ‘only product’ search. like on desktop.

    What is the correct php files to modify and how ?

    searchform.php search.php ?

    Thanks in advance

    Attachments:
    You must be logged in to view attached files.
    #298067
    David Martin – Support
    Moderator
    Post count: 20834

    Hi,

    I have added this into the next release. Please install and activate the supplied child theme, inside the child theme functions.php file and paste in this:

        /* MOBILE MENU
        ================================================== */
        if ( ! function_exists( 'nota_mobile_menu' ) ) {
            function nota_mobile_menu() {
    
                global $post, $woocommerce;
                $nota_options = nota_get_theme_opts();
                
                $header_search_pt = $nota_options['header_search_pt'];
                $mobile_header_layout = $nota_options['mobile_header_layout'];
                $mobile_show_social = $nota_options['mobile_show_social'];
                $mobile_show_translation = $nota_options['mobile_show_translation'];
                $mobile_show_search      = $nota_options['mobile_show_search'];
                $mobile_menu_type        = "overlay";
                $fs_close_icon = apply_filters( 'nota_fullscreen_close_icon', '<i class="fa-times"></i>' );
                if ( isset( $nota_options['mobile_menu_type'] ) ) {
                    $mobile_menu_type = $nota_options['mobile_menu_type'];
                }
                $page_menu = "";
    
                if ( $post && !is_search() ) {
                    $page_menu = nota_get_post_meta( $post->ID, 'sf_page_menu', true );
                }
    
                $mobile_show_cart    = $nota_options['mobile_show_cart'];
                $mobile_show_account = $nota_options['mobile_show_account'];
                $login_url           = wp_login_url();
                $logout_url          = wp_logout_url( home_url('/') );
                $my_account_link     = get_admin_url();
                $myaccount_page_id   = get_option( 'woocommerce_myaccount_page_id' );
                if ( $myaccount_page_id ) {
                    $my_account_link = get_permalink( $myaccount_page_id );
                    $logout_url      = wp_logout_url( get_permalink( $myaccount_page_id ) );
                    $login_url       = get_permalink( $myaccount_page_id );
                    if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) {
                        $logout_url = str_replace( 'http:', 'https:', $logout_url );
                        $login_url  = str_replace( 'http:', 'https:', $login_url );
                    }
                }
                $login_url        = apply_filters( 'nota_header_login_url', $login_url );
                $register_url     = apply_filters( 'nota_header_register_url', wp_registration_url() );
                $my_account_link  = apply_filters( 'nota_header_myaccount_url', $my_account_link );
    
                if ( get_option( 'woocommerce_enable_myaccount_registration' ) && $myaccount_page_id ) {
                    $register_url = apply_filters( 'nota_header_register_url', $my_account_link );
                }
    
                $mobile_menu_args = array(
                    'echo'           => false,
                    'theme_location' => 'mobile_menu',
                    'walker'         => new nota_alt_menu_walker,
                    'fallback_cb'    => '',
                    'menu'           => $page_menu
                );
    
                $mobile_menu_output = "";
    
                if ( $mobile_header_layout == "left-logo" || $mobile_header_layout == "center-logo-alt" ) {
                    $mobile_menu_output .= '<div id="mobile-menu-wrap" class="menu-is-right">' . "\n";
                } else {
                    $mobile_menu_output .= '<div id="mobile-menu-wrap" class="menu-is-left">' . "\n";
                }
    
                $mobile_menu_output .= '<nav id="mobile-menu" class="clearfix">' . "\n";
    
                if ( function_exists( 'wp_nav_menu' ) ) {
                    $mobile_menu_output .= wp_nav_menu( $mobile_menu_args );
                }
    
                $mobile_menu_output .= '</nav>' . "\n";
    
                $mobile_menu_output .= '<div class="mobile-menu-aux">' . "\n";
                
                if ( $mobile_show_social ) {
                    $mobile_menu_output .= '<div class="mobile-social-wrap">' . do_shortcode('[social]') . '</div>' . "\n";
                }
                if ( $mobile_show_translation && ( function_exists( 'pll_the_languages' ) || function_exists( 'icl_get_languages' ) ) ) {
                    $mobile_menu_output .= '<ul class="mobile-language-select">' . sf_language_flags() . '</ul>' . "\n";
                }
                if ( $mobile_show_search ) {
                    $mobile_menu_output .= '<form method="get" class="mobile-search-form" action="' . esc_url(home_url('/')) . '/">' . "\n";
                    $mobile_menu_output .= '<input type="text" placeholder="' . esc_html__( "Search", 'nota' ) . '" name="s" autocomplete="off" />' . "\n";
                    if ( $header_search_pt != "any" ) {
                        $mobile_menu_output .= '<input type="hidden" name="post_type" value="' . $header_search_pt . '" />';
                    }
                    $mobile_menu_output .= '</form>' . "\n";
                }
                $mobile_menu_output .= '</div>' . "\n";
    
                $mobile_menu_output .= '</div>' . "\n";
    
                echo $mobile_menu_output;
            }
    
            add_action( 'nota_before_page_container', 'nota_mobile_menu', 40 );
        }

    Thanks,
    David.

    #298072
    Stonedb
    Member
    Post count: 34

    Great job, thanks 🙂

    #298074
    David Martin – Support
    Moderator
    Post count: 20834

    Anytime, happy to help you out.

    If you have found the theme/support useful, we appreciate it if you can leave feedback on our item.

    Thanks,
    David.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register