WordPress.org

Ready to get started?Download WordPress

Forums

Quark
[resolved] Adding Search Functionality (3 posts)

  1. TrekRight
    Member
    Posted 1 year ago #

    Hi Everyone,

    Any recommendations on the best way to add search functionality to my site without using widgets? I don't think there is a shortcode available (by default).

    Is adding a shortcode via PHP the best approach? (easy enough to do, but then I either need to set up a child theme or lose the ability to update Quark).

    Or is there a particular plugin that works well with Quark?

    Other options?

    Thanks in advance for any help.

  2. ahortin
    Member
    Theme Author

    Posted 1 year ago #

    You can add a search form using the following php. Simply add it to wherever you'd like it displayed, such as the sidebar.

    <?php get_search_form(); ?>

    Using the above php, Quark will render the WordPress built-in search form. If you want to customise it, simply create a searchform.php file and add something like the following...

    <form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
    	<label>
    		<span class="screen-reader-text">Search for:</span>
    		<input type="search" class="search-field" placeholder="Search …" value="" name="s" title="Search for:" />
    	</label>
    	<input type="submit" class="search-submit" value="Search" />
    </form>

    You can read more about this on the WordPress Codex.

  3. TrekRight
    Member
    Posted 1 year ago #

    Thanks, Anthony - much appreciated.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.