Support » Plugin: Bop Search Box Item Type For Nav Menus » Search Box does not appear as expected

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author joe_bopper

    (@joe_bopper)

    Hi jayhova4x4,

    Sorry to hear you’re having trouble.

    This isn’t actually an issue with this plugin, but with your theme’s css. Its defaults seem to make the input field the same color as the background when not in focus. If you click the area to the left of the SEA, you’ll find a search box appears. You can experiment with how it all appears by making css changes in your browser’s dev tools (generally f12 on the keyboard). Once you’re satisfied, you can transfer those changes to your theme’s stylesheet.

    Hope this helps.

    Cheers,
    Joe

    P.S. I’ve marked this as resolved as this issue is in your theme and not in this plugin. Of course though, if you have further trouble don’t hesitate to get in touch.

    I get an error loading images/search-icon.png. How can I fix this? This is in the Twenty-Sixteen theme.

    Plugin Author joe_bopper

    (@joe_bopper)

    Hi,

    You’re missing the /wp-content/themes/twentysixteen/ part of the url. So, it should be /wp-content/themes/twentysixteen/images/search-icon.png.

    Cheers,
    Joe

    Hey Joe, where you going with that plugin on your site? 🙂

    I’m unable to locate the directory you indicated. I’m still a bit of a newbie, not having really dived into the inner workings of the WP thing. I’m thinking I could solve the whole where is the invisible search box thing with a place holder.

    Every time I google the “Search box wordpress” thing I get a different answer. I’m using a slightly modified version of Twenty-Sixteen which is pretty standard in the WP world of few standards but I’m having a hard time finding a source for information to do what I want to do; make the search box easy to use and put an icon in the button hole.

    Here is the searchform.php for the theme if this is any help.

    <?php
    /**
     * Template for displaying search forms in Twenty Sixteen
     *
     * @package WordPress
     * @subpackage Twenty_Sixteen
     * @since Twenty Sixteen 1.0
     */
    ?>
    
    <form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
    	<label>
    		<span class="screen-reader-text"><?php echo _x( 'Search for:', 'label', 'twentysixteen' ); ?></span>
    		<input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Search &hellip;', 'placeholder', 'twentysixteen' ); ?>" value="<?php echo get_search_query(); ?>" name="s" />
    	</label>
    	<button type="submit" class="search-submit"><span class="screen-reader-text"><?php echo _x( 'Search', 'submit button', 'twentysixteen' ); ?></span></button>
    </form>
    Plugin Author joe_bopper

    (@joe_bopper)

    Hi Jay,

    I’m not entirely sure what you’re after here.

    In terms of where I’m going with the plugin, I feel it is feature complete. That is, unless something changes with WordPress Core or a user finds a bug, I’ll be making no updates. As many support requests as I get regarding the styling of the output, I have no intention of making any additions on this front.

    (Explanation: This is because I have no idea how any of the gazillions of WordPress themes are going to display their menu items and thus no way of telling the size of container, the colour scheme, alignments, etc., and thus would be adding extra bloat to the plugin only to have as many support requests asking to undo any styles I’d have imposed. Instead, I used the WP default search form html (or at least as similar as it could be) in the hope that most themes would use this also.

    Further, it is something that would go against the paradigm that plugins add function, whereas themes are for look and feel.)

    From your original post, I think all you’re needing is some style changes. To do this, all you need to do is add some css (lower in the html document – the “cascade” – than the main theme styles) which changes the colours and sizes, etc., of the different parts of the form.

    When adding an image in css you need to either know where the image is relative to the root of your site (its url) or relative to your stylesheet.

    When you say you’re using a modified version of twentysixteen, is that a child theme? Because it’s inadvisable to make modifications to a theme directly as updates will overwrite your changes. It isn’t wise to copy those files over to a new directory and edit there either as then you miss updates which will generally be used to cover bugs and security holes.

    Here’s the official codex on child themes: https://codex.wordpress.org/Child_Themes

    Hope this helps.

    Cheers,
    Joe

    jayhova4x4

    (@jayhova4x4)

    Joe,
    It seems the problem is partially my fault. More than a year ago I added styling that affected the search box. I never removed it because it didn’t affect the search box. Does this seem contradictory. Does to me too. Never the less that’s the case. The 2016 theme uses a search widget. This creates a problem for me, the user, as all the official information pertaining to styling the 2016 theme ‘search’ refers to widget and not the search bar that your plugin uses. Basically I removed all of the CSS and plugins and found the search bar in the nav menu still messed up. I removed all the styling I included trying to style the ‘widget” a year ago when I knew even less than I do now which isn’t much.

    My frustration stems from the fact that while your plugin does place the search bar in the nav menu it’s not the search function the theme is set up to use so it’s not even styled to be functional. Nor is there any documentation on how to fix this because it’s not intended to be functional. Hence my frustration. Not sure what you can do about this but you should probably aware of the issue.

    I’ve enable the search in the sidebar so you can see what I mean.

    http://www.underlair.com

    Plugin Author joe_bopper

    (@joe_bopper)

    Hi Jay,

    I understand your frustration and it does certainly seem odd that you added styles and yet they had no effect.

    It’s also an annoying thing that twentysixteen doesn’t actually use the default core markup.

    The output I’ve tried to stick as close to possible to is that from the core function get_search_form, which isn’t especially different from the twentysixteen html, but enough that it doesn’t display brilliantly in that theme.

    I hadn’t actually really looked into this before, so thanks for pointing it out. That said, I don’t think there’s any way for me to pragmatically change the plugin to account for this variation between core and other themes.

    Hope you can resolve your styling issues.

    Cheers,
    Joe

    jayhova4x4

    (@jayhova4x4)

    The styles I added effected the search bar you enabled (not used by default) not the search widget that came with the theme. I never took the stylings out because from my point of view they had no effect.

    Plugin Author joe_bopper

    (@joe_bopper)

    Ah, right. Fair enough.

    jayhova4x4

    (@jayhova4x4)

    Okay, I have figured out most of the styling issues for the search field using bits of the CSS I had entered way back when.

    .site-header .search-field {
            background-color: grey;
    	height: 30px;
    	margin: 6px 0;
    	padding: 0 0 0 20px;
    	-webkit-transition: width 400ms ease, background 400ms ease;
    	transition:         width 400ms ease, background 400ms ease;
    	width: 0;
    }

    The thing that I am still banging my head against is the submit button. I want to give this an icon button like the widget and the search bar at the top of this page. I have figured out that I need to change the below:

    <input type="submit" class="search-submit" value="Search">
    to
    <button type="submit" class="search-submit" value="Search"></button>

    The bottom one is how the widget works and how searchform.php is set. For the life of me, I cannot figure out where this is changed.

    Plugin Author joe_bopper

    (@joe_bopper)

    Hi,

    There are filters in the plugin that allow you to modify the output. In this case, you could use:

    add_filter( 'bop_nav_search_show_submit_button', function( $show, $item, $depth, $args ){
      $show = false;
    
      ?>
      <button type="submit" class="search-submit" value="Search"></button>
      <?php 
    
      return $show;
    }, 10, 4 );

    Adding this to your functions.php will stop the default input element from being shown and will instead output the button element.

    Hope this helps.

    Cheers,
    Joe

    • This reply was modified 2 years ago by  joe_bopper. Reason: Clarity: 'default button' changed to 'default input element'
    jayhova4x4

    (@jayhova4x4)

    Success! didn’t take at first then I realized I had not re-enabled the child theme. Now all that’s left to do is style the button and we are off to the races.

    Thanks again Joe

    Plugin Author joe_bopper

    (@joe_bopper)

    No problem. I’m pleased you got it all sorted.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Search Box does not appear as expected’ is closed to new replies.