• Resolved indietrash

    (@indietrash)


    hi,

    I want my search box to say “search for…”. as in, I want the default input of the seach box to be “search for…”, so that people see that it’s a search box – not just a weird box. could anyone help me with this? I have basically no knowledge of php myself. =/ here is my php:

    <?php
    get_header();
    ?>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <div <?php post_class() ?> id=”post-<?php the_ID(); ?>”>

    <div id=”small”><smallbg><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></smallbg></div>

    <h2>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h2>

    <div class=”entry”>
    <?php the_content(‘Read the rest of this entry »’); ?>
    </div>

    <p class=”postmetadata”><i><?php the_tags(‘Tags: ‘, ‘, ‘, ‘
    ‘); ?></i>Posted in <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’, ”, ‘ ‘); ?> </p>
    </div>

    <?php endwhile; ?>

    <div class=”navigation”>
    <div class=”alignleft”><?php next_posts_link(‘« Older Entries’) ?></div>
    <div class=”alignright”><?php previous_posts_link(‘Newer Entries »’) ?></div>
    </div>

    <?php else : ?>

    <h2 class=”center”>Not Found</h2>
    <p class=”center”>Sorry, but you are looking for something that isn’t here.</p>
    <?php get_search_form(); ?>

    <?php endif; ?>

    <?php get_footer(); ?>

Viewing 7 replies - 16 through 22 (of 22 total)
  • Thread Starter indietrash

    (@indietrash)

    Thread Starter indietrash

    (@indietrash)

    the search form looks like it is in the function.php in both the default and the classic theme as well, btw.

    I think if you open sidebar.php and find this:

    <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <div>
    <input type="text" name="s" id="s" size="15" /><br />
    <? /*<input type="submit" value="<?php _e('Search'); ?>" />*/?>
    </div>
    </form>

    notice how this: <? /*<input type="submit" value="<?php _e('Search'); ?>" />*/?> is commented out? “/*….. */” Un-comment it, and make your edits to suit your needs between the form tags in sidebar.php, and I think you will be okay. Un-commenting, will initially place a search form button with text below the box. Some clever manipulation may make that work for you. Good luck!

    p.s. I still have some vulnerability concerns about this:

    <?php echo $_SERVER['PHP_SELF']; ?>

    …but someone sharper than me will have to confirm or deny if that might actually be unsafe.

    Thread Starter indietrash

    (@indietrash)

    actually I just modified the one that wasn’t /**/ out, like so:

    <input type=”text” name=”s” value=”search for…” id=”s” size=”15″ onclick=”value=”” onblur=”value=’search for…'” />

    and it worked great. thanks! ??

    I think this basically does what you want -sans the input button of course;

    <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <div>
    <input type="text" name="s" id="s" size="15" value="Search" onfocus="if (this.value == 'Search') {this.value = '';}"
    onblur="if (this.value == '') {this.value = 'Search';}"/>
    <br />
    </div>
    </form>

    Cool!

    Take care.

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘editing my search box’ is closed to new replies.