Home › Forums › General Issues › WYSIWYG Field and More Tag
I have a WYSIWYG field which I want to generate an excerpt for that would give the administrator the option of manually entering/placing the more tag, and if no more tag is present display an excerpt of a set word length. I successfully set up code for displaying the excerpt at a set word length (using the apply_filters function), however I am having trouble getting the manually entered more tag to display. How would I go about doing this?
The issue I am having is even when I have added a read more tag in the WYSIWYG field in the Word Press admin (I can see the <!–more–> in the WYSIWYG in the admin), the more tag doesn’t seem to be returned to the template. If I do a simple test to return the field back to the browser both of the following do not include the more tag:
$my_field = get_field('my_field'); echo($my_field);
$my_field = get_field('my_field'); $my_field = apply_filters('the_content', $my_field); echo($my_field);
Any idea what I am missing here? Basically I need a way of checking if the content for the field contains a more tag, however since the more tag isn’t being returned I can’t check for it.
Hope everything above makes sense and thank you in advance for any feedback!
See the answer I posted here https://support.advancedcustomfields.com/forums/topic/acf-repeater-excerpt/
Thanks for getting back to me an sorry I didn’t have a chance to get back to you earlier. I was already using the code you linked to generate the excerpt at a custom word length, found this solution when researching this for another project a couple years ago (thanks for linking to this again, excellent solution).
What I am still confused about is even when I set a more tag at a specific spot in the text (through the toolbar for the WYSIWYG field), the more tag doesn’t appear to be returned when getting the field contents in with get_field. I thought I might have made a template error in not checking for the more tag, however it doesn’t appear to be there at all. Is there something in the get_field function which is stripping out the more tag?
No rush on this, please get back to me when you have a chance. Thanks again for your help!
What version of ACF are you using?
I am having the same problem, and I’m using the most recent version of ACF.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.