How to only show the default wp post text in results

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How to only show the default wp post text in results

This topic contains 2 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 1 year, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #41194
    kyrian
    kyrian
    Participant

    UPDATE
    I found out that I can use {__content maxlength=130} to achieve what I ask below.

    But there are layout issues.
    I am using this code

    <div class="search-description">{__content maxlength=130}</div><div class="post-type-label"><span class="category-label">{__post_type}</span> [<span class="med-time-label">{video_duration} min.</span>]</div>

    layout it’s broken here, scroll the results until you see it
    https://accademiainfinita.it/2/contenuti/

    maybe {__content maxlength=130} is not able to strip html tags and there are some shortcodes or other code creating problems? Not sure.
    The WP post where the layout gets broken is this one https://accademiainfinita.it/2/contenuti/scienza/i-mille-usi-dei-microrganismi-efficaci-em/

    I think this may be due to HTML tags not getting stripped, because that post has a link at the very beginning of the text

    Search Form Name : “Contenuti”

    =============

    Hello,
    I have a search form showing results from default wp posts and a “video” custom post type

    I want to show an extract of the post text only for the wp post BUT NOT for the videos

    So I created a video_description ACF field for my “video” post type and used that to put the video descriptions, while leaving empty the default wp content area.

    But in frontend Ajax Search PRO still shows the description text even for my videos.
    It’s doing this through the {descriptionfield} tag, so I guess this tag grabs whatever text it finds associated with the post, even if it’s in a custom field?

    Is there any way I can achieve what I want. I looked in the documentation but I don’t see a specific tag to ONLY show the wp default post content text.

    Thanks

    • This topic was modified 1 year, 4 months ago by kyrian .
    • This topic was modified 1 year, 4 months ago by kyrian .
    • This topic was modified 1 year, 4 months ago by kyrian .
    • This topic was modified 1 year, 4 months ago by kyrian .
    #41205
    kyrian
    kyrian
    Participant

    I was able to solve this by getting rid of {__content maxlength=130}
    and using {descriptionfield} instead, but grabbing the text from the post content instead than from the excerpt.

    I still think {__content} has issues with html tags though.

    #41217
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Okay, that sounds right. The __content field is the raw content (if needed), it is not processed. The trimming of 130 characters had left some unclosed HTML very likely.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


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

You must be logged in to reply to this topic.