WordPress.org

Ready to get started?Download WordPress

Forums

default WIDGET search box to the NON-widget one line search box + button display (7 posts)

  1. awsnap97
    Member
    Posted 7 years ago #

    I love the style of the default kubrick search, like: http://managedtasks.com/wpthemes/blog/ w/ a search FORM + search BUTTON on one-line.

    However, I need to use widgets. The search widget displays the search box + button differently.

    I edited my style.css to take away the padding style, from:

    #searchform {
    margin: 10px auto;
    padding: 5px 3px;
    text-align:center;
    }

    to

    #searchform {
    margin: 10px auto;
    padding: 0px;
    }

    ... but i still cannot achieve the desired effect.

    Any help would be greatly appreciated, I really truly have tried to search as hard as I can, and have even contacted some blog owners, w/ no results. :(

    Thanks everyone!

  2. awsnap97
    Member
    Posted 7 years ago #

    anyone?

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Without actually seeing your page, it's extremely hard to tell you what changes to make to the CSS file.

    Post a link to the page in question.

  4. zebmacahan
    Member
    Posted 6 years ago #

    Greetings!

    Perhaps a bit late, but since I stumbled upon this lately, I suppose you could use some info in this post (http://appneed.com/corp/2008/03/13/customise-search-widget/)

    They use another theme, but the same reason apply: The search widget simply lacks certain attributes compared to other widgets, they need to be there in order for you to style them...

    Cheers!

    //ZM

  5. phocks
    Member
    Posted 6 years ago #

    I have no idea why this isn't changed so that they both look the same. Seems strange to me. I may try submitting my first patch, but I'm not entirely sure of the process.

    My fix was simple:

    Edit wp-includes/widgets.php

    find the "wp_widget_search($args)" function, delete the following lines:

    <form id="searchform" method="get" action="<?php bloginfo('home'); ?>">
    <div>
    <input type="text" name="s" id="s" size="15" />
    <input type="submit" value="<?php echo attribute_escape(__('Search')); ?>" />

    and add these in place (copied from the default theme's searchform.php :

    <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
    <div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
    <input type="submit" id="searchsubmit" value="Search" />

    Note: I am using 2.5 RC1.1 so it might be different, but this should give you an idea anyway.

  6. kickass
    Member
    Posted 6 years ago #

    Phocks, you could have accomplished that in the theme's function.php by overriding the code in the search widget. It's safer to do it this way since the theme files don't get overwritten when you upgrade wordpress. Details here:

    http://automattic.com/code/widgets/api/

    It is possible for theme authors to define replacement widgets within functions.php. Replace an existing widget by registering its name with a new callback. An empty callback will unregister a widget.
    Because each widget has a unique name and a non-unique callback, the default markup before a widget looks like this:

    <li id="{name}" class="{callback}">{callback output}</li>

    When you register a widget you may pass a custom classname to replace callback. This is most useful for object-oriented widgets whose callbacks are passed as arrays.

  7. phocks
    Member
    Posted 6 years ago #

    Thanks kickass, it looks like someone has submitted a patch that should make the widget look for a searchform.php file in the templates dir and use that if found.

    http://trac.wordpress.org/ticket/5567

    Will probably be implemented in 2.6

    The widget override is a great idea, but I had a little trouble working out how to do it properly. I'll try again when I have time.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.