Customizing code for the search bar

Community Forums Forums Design Tips and Tricks Customizing code for the search bar

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  nutsandbolts 8 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #71777

    guaranteervblogger
    Participant
    Post count: 4

    I am using the Backcountry theme. I used the widget search bar to create it on each page but I have a question. Is there a way to create a list rather than have full articles appearing with the keywords that were typed in? For example, if I type in Calgary Flood, a couple of articles come up but rather than appear as a list, the whole articles are appearing one after another. Is there a way to have a search bar bring up a list when searching for a topic instead of full articles? Thanks in advance. grvblogger

    Website: http://guaranteerv.com/blog/

    http://guaranteerv.com/blog/
    #71780

    nutsandbolts
    Moderator
    Post count: 3104

    You can add this to functions.php to have the search results show excerpts instead of full posts:

    add_action( 'genesis_before_loop', 'sk_excerpts_search_page' );
    function sk_excerpts_search_page() {
      if ( is_search() ) {
    		add_filter( 'genesis_pre_get_option_content_archive', 'sk_show_excerpts' );
    	}
    } 
    function sk_show_excerpts() {
    	return 'excerpts';
    }

    I know that isn’t exactly what you asked about, but a list of excerpts is way better than a bunch of full posts. Hope that helps!


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.