• Resolved kpkreative

    (@kpkreative)


    Hi there,

    I know it is possible to replace label text with placeholder text for a select box, though is it possible to also do so on the search bar in a members directory for field_any_contains so it could read something like ‘Search…’ as a placeholder?

    Thanks in advance
    KP

    • This topic was modified 1 year, 9 months ago by kpkreative.
    • This topic was modified 1 year, 9 months ago by kpkreative.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Andrea Tarantini

    (@dontdream)

    Hi KP,

    To add a placeholder to a text search field you can modify the form template. Open bps-form-default.php, locate the lines:

    	case 'textbox':
    ?>
    			<input type="search" id="<?php echo $id; ?>" name="<?php echo $name; ?>" value="<?php echo $value; ?>"><br>
    <?php
    	break;
    

    and replace them with:

    	case 'textbox':
    ?>
    	<?php if ($f->code == 'field_any') { ?>
    			<input type="search" placeholder="my placeholder" id="<?php echo $id; ?>" name="<?php echo $name; ?>" value="<?php echo $value; ?>"><br>
    	<?php } else { ?>
    			<input type="search" id="<?php echo $id; ?>" name="<?php echo $name; ?>" value="<?php echo $value; ?>"><br>
    	<?php } ?>
    <?php
    	break;
    

    Save the file, and move it to the buddypress/members directory in your theme’s root. For details on modifying form templates, please see:

    https://dontdream.it/bp-profile-search/form-templates/

    Thread Starter kpkreative

    (@kpkreative)

    Hi Andrea,

    Thank you so much for your feedback on this, I really appreciate it.

    I will try this out today and hopefully that will resolve the issue.

    Best regards,
    KP

    Plugin Author Andrea Tarantini

    (@dontdream)

    You are welcome, let me know how it works!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Placeholder text for search field’ is closed to new replies.