• Resolved RayR75

    (@rayr75)


    Hi, I hope you are all good!

    In my search page results, I would like to show the source too (see below).So people can click on this link and go to the actual page when desired.

    Then, ideally, next to showing the source, I would also like to show just a snippet of the search results instead of showing the entire page appearing in the search result page.

    I don’t want to use a plugin for this. I hope someone can help.

    Thank you, and take care ??

    Ray

    Example:

    —————–

    SEARCH RESULTS:

    This is just a snippet of the search results blablabla. Lorem ipsum aut ut reiciendis repellat saepe ullam quae officiis debitis. Est voluptas qui nostrum. Magnam qui qui quae repellat odit….

    Source: https://www.mywebsite.com/sample-post

    • This topic was modified 4 years, 2 months ago by RayR75.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Check your theme for an option. If it doesn’t have an option for this, you can create a child theme and modify the search template. Or switch themes. Or ask at the theme’s support forum for help (or an option).

    Most themes do show excerpts on the search page. I have seen many themes (when doing theme review) that do not, however, so I always left a comment to switch it to excerpts.

    Thread Starter RayR75

    (@rayr75)

    Thank you Joy! ??

    I forgot to mention that I am not using a theme but creating my own.

    I am indeed working on modifying the search template. I just need to figure out what code snippet I need to use for this.

    Instead of the_content() use the_excerpt().
    And you can use the_title() or the_permalink().
    Use the Code Reference to find all the functions.

    Thread Starter RayR75

    (@rayr75)

    Joy, you’re a legend ??

    This seems to go right into the direction I was looking for. I will go through the ‘Code Reference’ as you mentioned too.

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to add page url (sample-post) in search results?’ is closed to new replies.