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 1 month, 3 weeks ago.
- AuthorPosts
- February 2, 2023 at 3:15 pm #41194
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 typeI 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
February 2, 2023 at 6:05 pm #41205I 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.
February 3, 2023 at 4:13 pm #41217Okay, 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 :)
- AuthorPosts
You must be logged in to reply to this topic.