Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #876947

    ottobono
    Participant

    Hi, I want to replace the default search bar in the teme with mine. I followed the instruction here: https://community.theme.co/forums/topic/add-shortcode-to-top-menu/. The problem is there is such file named _topbar.php but only _topbar.scss and it can be found under wp-content/themes/x/framework/css/src/site/_scss/stacks/integrity (I am using integrity stack).

    The developer of ajax search pro wrote what I have to do, but I do not know what to do exactly. I attach a pic here. Can you help me please? Thank you!

    #877685

    Christopher
    Moderator

    Hi there,

    Please copy the file _topbar.php from wp-content/themes/x/framework/views/global and put it in the same path inside child theme which would be wp-content/themes/x-child/framework/views/global. Then you can place provided code in this file.

    Add your CSS to customizer or child theme’s style.css file.

    Hope it helps.

    #877784

    ottobono
    Participant

    Hi, thank you for your answer! I copied the file in the right location and I modified the file but it still does not work. this is my code in my _topbar.php

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_TOPBAR.PHP
    // -----------------------------------------------------------------------------
    // Includes topbar output.
    // =============================================================================
    
    ?>
    
    <?php if ( x_get_option( 'x_topbar_display' ) == '1' ) : ?>
    
      <div class="x-topbar">
        <div class="x-topbar-inner x-container max width">
          <?php if ( x_get_option( 'x_topbar_content' ) != '' ) : ?>
          <?php echo do_shortcode('[wpdreams_ajaxsearchpro id=2]') ?>
          <p class="p-info"><?php echo x_get_option( 'x_topbar_content' ); ?></p>
          <?php endif; ?>
          <?php x_social_global(); ?>
        </div>
      </div>
    
    <?php endif; ?>

    If I do not write the ” I receive a parse error on loading of the website, otherwise no error but still no replaced search field, there is still the “old” search icon that works in fullscreen if you click on it. What do have I to do?

    #878310

    Zeshan
    Member

    Hi there,

    Please provide us with your site URL so we can take a closer look to your setup. Please note that we cannot guarantee a solution here as it’s related to a 3rd party plugin.

    Thank you!

    #879646

    ottobono
    Participant
    This reply has been marked as private.
    #880088

    Jack
    Keymaster

    Hi there,

    Thanks for writing back!

    Could you post the FTP details in a private reply as well please? This is so we can access the code of the child theme and make changes as required. 🙂

    Thank you!

    #884418

    ottobono
    Participant
    This reply has been marked as private.
    #884717

    ottobono
    Participant

    Hi, wit 404 errors (like if you type random page names) there is the ajax search bar, but on the main menu there is still the old search method.

    #885277

    Christopher
    Moderator

    Hi there,

    Please activate topbar from Customize -> Header.
    Disable navbar search from Customize -> Header -> Search.
    Update your code in _topbar.php file to :

    <?php echo do_shortcode('[wpdreams_ajaxsearchpro id=2]'); ?>

    Hope it helps.

    #885396

    ottobono
    Participant

    Hi, I did exactly as you said and it did not work 🙁

    #885537

    ottobono
    Participant

    Hi, almost resolved! Problem was the right file was not .topbar but .navbar! Now I have the problem that the main search is too big, and that it does not go inside the mobile navbar but stays on the outside. How to fix it?

    #885541

    ottobono
    Participant

    From the desktop it is still too big (I can resize it from ajax search pro customization), but I do not know how to increase the distance from the other element (cart), also to have the same padding between elements. My _navbar.php looks like this:

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_NAVBAR.PHP
    // -----------------------------------------------------------------------------
    // Outputs the navbar.
    // =============================================================================
    
    $navbar_position = x_get_navbar_positioning();
    $logo_nav_layout = x_get_logo_navigation_layout();
    $is_one_page_nav = x_is_one_page_navigation();
    
    ?>
    
    <?php if ( ( $navbar_position == 'static-top' || $navbar_position == 'fixed-top' || $is_one_page_nav ) && $logo_nav_layout == 'stacked' ) : ?>
    
      <div class="x-logobar">
        <div class="x-logobar-inner">
          <div class="x-container max width">
            <?php x_get_view( 'global', '_brand' ); ?>
          </div>
        </div>
      </div>
    
      <div class="x-navbar-wrap">
        <div class="<?php x_navbar_class(); ?>">
          <div class="x-navbar-inner">
            <div class="x-container max width">
              <?php x_get_view( 'global', '_nav', 'primary' ); ?>
    <?php echo do_shortcode('[wpdreams_ajaxsearchpro id=2]'); ?>
            </div>
          </div>
        </div>
      </div>
    
    <?php else : ?>
    
      <div class="x-navbar-wrap">
        <div class="<?php x_navbar_class(); ?>">
          <div class="x-navbar-inner">
            <div class="x-container max width">
              <?php x_get_view( 'global', '_brand' ); ?>
              <?php x_get_view( 'global', '_nav', 'primary' ); ?>
    <?php echo do_shortcode('[wpdreams_ajaxsearchpro id=2]'); ?>
            </div>
          </div>
        </div>
      </div>
    
    <?php endif; ?>
    #885560

    ottobono
    Participant

    I modified the layout of my ajax search and set it as standard search but it does not show up formatted as I did. Why is that? Edit: resolved (at least only this problem)

    #885673

    ottobono
    Participant

    Hi, I decided to simply not use the bar in the main menu, but only in the product page, in the news page and in the about us page (3 different search bars with 3 differents type of searchable items). it is “resolved” now 🙂

    #886337

    Christian
    Moderator

    Glad you’ve sorted it out. 🙂