• Im using Listify with FacetWP plugin and I’d like to change the value of the homepage search button to put there call to action instead. But I can’t locate the code to make this change. I was able to change the placeholder, but can’t do that for the Search button. I looked for similar topics and couldn’t really find anything except editing searchform.php file which didn’t make any changes to me. Thanks for any help.
    Link to my site: calsolarcontractors.com

Viewing 6 replies - 1 through 6 (of 6 total)
  • I tried to click on your link and got nowhere, sorry, but maybe you can tell us how your home page search box is added? Via a widget or a PHP snippet in your template file? Or by a plugin, maybe the FacetWP plugin?

    If it’s the plugin you’ll need to post in the FacetWP support forum (or the forum of whatever plugin is adding it).

    If it is the stock WP widget, OR if it’s called in your homepage template file like this:
    <?php get_search_form(); ?>
    Then it uses searchform.php. If your Theme/Child theme doesn’t HAVE a file called searchform.php, then WP will use a default one of it’s own (from the core files).

    (If it’s some other method, please be specific about it when you post back.)

    NOW while you could, theoretically, create or edit a searchform.php file, keep in mind that this file would be called from *anywhere* on your site where you have a search box, which may include other pages and your 404 page.

    SO if you modify searchform.php to change the value of that button, it will be changed everywhere.

    If you have NO other search forms (be sure to check your 404 template as well) and you don’t care if the button shows the same value everywhere, then just modify searchform.php.

    Open it in a text editor, it will likely look like this:

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

    See that last line, where it says ‘value=”Search” ? Just change that value to your call to action.

    If you don’t want that call to action to show up on every search form’s submit button, then just create your own search form for your home page only.

    If it’s put on your home page via a search widget, just replace that search widget with a text widget and past in the form code BUT note that you’ll likely need the PHP Text Widget plugin, which lets you put PHP into text widgets.

    If it’s added to your homepage via a template file, just replace the get_search_form call with your HTML code for the form.

    Thread Starter searay

    (@searay)

    omg.. really sorry for that.. the link is calsolarcontractors.com

    You can have a look at the site, while I try your solution with searchform.php

    Thread Starter searay

    (@searay)

    Im using listify child theme but there is no searchform.php. It is on the main theme together with one more searchform-header.php file.

    I tried to edit values in both but with no luck. I have facetWP filtering on Homepage, but I checked all the files for this plugin and there is nothing about search button. It has to use the listify search feature or WP job manager, which I also have installed. Anyways.. below are codes of both files, any ideas? Tried also Say what plugin to translate the button, but with no luck either.

    Searchform.php

    <?php
    /**
     * The template for displaying a standard search form.
     *
     * @package Listify
     */
    ?>
    
    <form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
    	<label>
    		<span class="screen-reader-text"><?php _e( 'Search for:', 'listify' ); ?></span>
    		<input type="search" class="search-field" placeholder="<?php esc_attr_e( 'Search', 'listify' ); ?>" value="Find"
    		name="s" title="<?php echo esc_attr_e( 'Search for:', 'listify' ); ?>" />
    	</label>
    	<button type="submit" class="search-submit"></button>
    </form>

    Searchform-header.php

    <?php
    /**
     * The template for displaying the header search form. Searches listings.
     *
     * @package Listify
     */
    ?>
    
    <form role="search" method="get" class="search-form" action="<?php echo esc_url( get_post_type_archive_link( 'job_listing' ) ); ?>">
    	<label>
    		<span class="screen-reader-text"><?php _e( 'Search for:', 'listify' ); ?></span>
    		<input type="search" class="search-field" placeholder="<?php esc_attr_e( 'Search', 'listify' ); ?>" value="Find" name="search_keywords" title="<?php echo esc_attr_e( 'Search for:', 'listify' ); ?>" />
    	</label>
    	<button type="submit" class="search-submit"></button>
    </form>

    Thanks for the updated link, I looked at your site (very nice!) and looked at your source code for the search forms – they are constructed using the FacetWP plugin. I don’t have a way of knowing if the search form itself (and the button) are created by FacetWP or if FacetwWP is just making use of searchform.php (if it exists).

    That means you will need to ask your question in the support forum for FacetWP and they should be able to help you. They are a highly regarded plugin and I’ve heard good things about their support. ??

    Good luck!

    Thread Starter searay

    (@searay)

    Thank you for your help. If I create searchform.php on my child theme and copy the code with my own Value will that work? Is it worth trying?

    Thanks

    Sure, it’s worth trying. But if your homepage button doesn’t change, then FacetWP is not using searchform.php.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Changing the Search button value’ is closed to new replies.