WordPress.org

Support

Support » Themes and Templates » [Theme: Twenty Eleven] – Change search results

[Theme: Twenty Eleven] – Change search results

  • Hey there, I’m using a child of twenty eleven theme.
    I want to change the way search.php is displaying search results.

    Currently search.php displays search results as:
    Post titles, along with a snippet of content for the post, and the continue reading link.

    However, my site’s posts/content are structured like this:

    Post name ‘A’
    (This contains lots of variations of foods beginning with the letter A as H3 headings, along with a paragraph description about each)
    Post name ‘B’
    (This contains lots of variations of foods beginning with the letter B as H3 headings, along with a paragraph description about each)
    etc…all the way up to Z.

    When you use the search box to search the term ‘apple’ for example, the results display the post name ‘A’, along with a little bit of content and then the click to read more. If the visitors click to read more then they will still have to scroll through the long list of foods on the ‘A’ post to find the one they were searching for, so this beats the purpose of using the search box since they could have just clicked post ‘A’ instead of using the search box.

    How can I modify search.php (within the child theme of course) to make it not display post titles, but instead display H3 headings which match the search term, and then this heading can also be the link to the post, which when clicked would need to bring you to the right position within the post where the relevant H3 heading is.

    Edit: Or alternatively, how to modify the search.php file to make it not display post titles, but instead display H3 headings which match the search term, along with the paragraph of text for those H3 headings. (so basically if someone searches ‘apple’ then the results would show the heading ‘apple’ along with the description about apples, which are found within post A)

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • WPyogi

    @wpyogi

    Forum Moderator

    Can you post a link to a search results page?

    Hey WPyogi, its local on my machine

    I guess a more simplified question would be:
    How can I edit search.php so that instead of displaying ‘post titles’ as the search results, it displays ‘post headings’ containing the search term along with the ‘paragraph content’ for that heading.

    WPyogi

    @wpyogi

    Forum Moderator

    I’m guessing there’s a way to do that, but unfortunately I don’t know enough about custom coding to be much help with it. Sorry ’bout that. Someone else may come along who can or you could see if it’s been answered before.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Theme: Twenty Eleven] – Change search results’ is closed to new replies.