• When I enter a search phrase in my blog entire articles are returned in the search results.

    Is it possible to have just the title and a short excerpt appear instead of the full article?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Joe, without a link or a theme it’s tough to answer definitively, but I’ll give it a general guess: edit your theme’s search.php file and change the line that says the_content() to be the_excerpt().

    Good to know: if your theme doesn’t have a search.php template then the archive.php will be used to display the search results. And given the unreasonably high number of users that have the not-so-smart idea to change the look of the archive.php to display full articles instead of the excerpt… here we go ??
    (btw, the Codex is wrong in the Template Hierarchy saying that if there is no search.php the index.php will be used.
    Edit: made the correction in Codex.)

    Thread Starter joeking

    (@joeking)

    ColdForged – you’re a star!

    My theme didn’t have a search.php so I borrowed and customised the default theme’s one and it works a treat!

    moshu: “btw, the Codex is wrong in the Template Hierarchy saying that if there is no search.php the index.php will be used.”

    Was the Codex actually wrong about that? I just deleted the search.php file from my theme, and when I ran a search, it was processed by the index.php file, not the archive.php file, as my archives are (and which is my preference for searches).

    Are other people getting different results?

    ColdForged Thanks so much for that info. I’ve been casually messing with that for a few days and you just made it all fall together for me. Thank ya!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Searching a blog – entire articles appear’ is closed to new replies.