• Resolved Tanzi001

    (@tanzi001)


    Hi,
    I don’t seem to have a search box in theme fruitful and I need one.
    I don’t want sidebars as I have an ecommerce site.
    I found the code for google search but can’t seem to find the right place to put it at the top of my site.
    I am relatively new, can anyone help please?

    Thanks

Viewing 15 replies - 1 through 15 (of 25 total)
  • Thread Starter Tanzi001

    (@tanzi001)

    I have one now but I can’t get it out of the top left hand corner.
    Any ideas
    I’ve tried
    #searchform {position:absolute; top: 25px; right: 10px; text-align:right;}
    in custom css, any ideas?

    Thread Starter Tanzi001

    (@tanzi001)

    nope gone again.
    I just need to check the search form php ( I have it but it doesn’t do anything )
    & the css to put in custom text.

    Thanks

    Can you post a link to your site?

    Thread Starter Tanzi001

    (@tanzi001)

    https://www.funkyweddingideas.com.au/

    here is a link. I have reverted back to a sidebar so I can have a search widget ?? but if you know how to fix it, it would make my day!

    Just so I’m clear on what you’re trying to do, I see a search form on this page: https://www.funkyweddingideas.com.au/product-category/accessories/, on the top left corner of the page, right above “Filter by price”. Is this the search form you’re trying to move?

    Thread Starter Tanzi001

    (@tanzi001)

    No that’s a widget and I can leave the side bar there if I have to but I kind of wanted the wordpress stand alone search box ??

    How did you have the search form before? Your CSS looks okay at first glance, so I’d like to see it in context to figure out what’s going wrong.

    Thread Starter Tanzi001

    (@tanzi001)

    I copied this of the forum and it stuck the search box in the left hand corner and nothing I did would move it

    Just add <div><?php include (TEMPLATEPATH . ‘/searchform.php’); ?></div>
    in header.php

    And add #searchform {position:absolute; top: 25px; right: 10px; text-align:right;}
    in Style.css.

    Can you temporarily put that code back in so I can see the search form on the site itself?

    Thread Starter Tanzi001

    (@tanzi001)

    Done!

    What’s happening is that the search form ends up stacking behind the page header. You could fix this by adding z-index to your custom CSS:

    #searchform {
    	position: absolute;
    	top: 25px;
    	right: 10px;
    	text-align: right;
    	z-index: 10;
    }

    Because you’re taking it out of the document flow when you use position: absolute, you might need to reposition it at different screen sizes using media queries:

    @media screen and (max-width: 500px) {
      #searchform {
        position: absolute;
        top: 25px;
        right: 10px;
        z-index: 10;
      }
    }
    
    @media screen and (min-width: 501px) and (max-width: 1200px) {
      #searchform {
        top: 35px;
        right: 35px;
      }
    }

    With this code, if the browser window is less than 500px wide, the search form will be positioned 25px from the top and 10px from the right, and if the browser window is between 501px and 1200px wide, the search form will be positioned 35px from the top and from the right.

    Thread Starter Tanzi001

    (@tanzi001)

    I put into custom CSS
    #searchform {
    position: absolute;
    top: 25px;
    right: 10px;
    background-color: #000000;
    text-align: right;
    z-index: 10;
    }
    @media screen and (max-width: 500px) {
    #searchform {
    position: absolute;
    top: 25px;
    right: 10px;
    z-index: 10;
    }
    }

    @media screen and (min-width: 501px) and (max-width: 1200px) {
    #searchform {
    top: 35px;
    right: 35px;
    }
    }
    and it is still in the corner,I added colour to see if it was reading it and it didn’t change colour at all (I could have put the colour in the wrong place)
    Thanks for all your time but it hasn’t moved. Do you think I should give up?

    Oh, right, I forgot. Since you appear to be using a caching plugin, you’ll probably need to temporarily disable the plugin and flush the cache before you’ll see any changes. You can (hopefully) find instructions on how to do that from your plugin’s author or documentation.

    And to clarify, you probably won’t want to use the exact values I posted in my previous post. Those were just for demonstration purposes. You should experiment with the placement until it looks right to you.

    Thread Starter Tanzi001

    (@tanzi001)

    I just saw this in my functions php is this something I need to adjust?
    /*rewrite get_product_search_form() function*/
    if ( ! function_exists( ‘fruitful_get_product_search_form’ ) ) {
    function fruitful_get_product_search_form(){
    ?>
    <form role=”search” method=”get” id=”searchform” action=”<?php echo esc_url( home_url( ‘/’ ) ); ?>”>
    <div>
    <input type=”text” value=”<?php echo get_search_query(); ?>” name=”s” id=”s” placeholder=”<?php _e( ‘Search for products’, ‘woocommerce’ ); ?>” />
    <input type=”submit” id=”searchsubmit” value=”<?php echo esc_attr__( ‘Search’ ); ?>” />
    <input type=”hidden” name=”post_type” value=”product” />
    </div>
    </form>
    <?php
    cheers

    Probably not. It looks like the function you posted only affects WooCommerce’s special search form, which you aren’t using. Have you temporarily disabled your caching plugin and flush the cache?

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘search box theme fruitful’ is closed to new replies.