• Resolved tmpol

    (@tmpol)


    Greetings,

    I’m having trouble making search results do something specific. I’m using the Headline theme, but I suspect it wouldn’t matter.

    Most of my posts are links to articles. Clicking a post’s title brings them offsite to an actual article from the original source. The post’s title is the same as the article’s title of whatever article it’s linked with.

    The post’s body has two things. First, A copy of the article’s subtitle or first paragraph pasted into the body. Then I include a link called “Alternative Article Link” that links to an archived copy of the actual article, usually archive.today or equivalent.

    Posts are categorized and menus set up accordingly, but I’ve got a problem with search results. They don’t show the “Alternative Article Link” as a link, it shows as just regular text and removes the space between it and the subtitle above it.

    I’ve tried some different plugins, searched through the forums and tried formatting the body a few different ways but haven’t had any luck. Is what I want even possible?

    I’d like to do some other customization with the search functionusing one of the plugins I tried but I want to know how to make those hyperlinks work within the search results first.

    Any ideas or suggestions are appreciated!

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Your theme has a search.php template file, as most themes do. It is likely using the_excerpt to output the snippet for the search page. Excerpts are either manually written, and can contain HTML, or generated, which means that they are truncated so the HTML tags have to be removed so the markup is correct. It sounds like yours are generated, so the link tags are stripped.

    To fix it, you can use manual excerpts or change the search template in a child theme to compute the snippet differently.

    Thread Starter tmpol

    (@tmpol)

    I just played around with putting the summary & link in the excerpt box and that worked. The search results showed the link.

    I might do it that way going forward, but if I’m understanding you correctly, it sounds like I’ll have to learn more about child themes if I don’t want to go back and fix each one of my old posts.

    Thanks for explaining how it works and some guidance going forward!

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

The topic ‘Links Within Search Results’ is closed to new replies.