Custom Post Type get_Preview renders instead of custom excerpt
-
I have a custom post type called newsletters, and in the “supports” array, I have given it excerpt. The issue is that when I run a foreach loop of the newsletters on the homepage and call
post.preview(20)
it returns a preview of the post from the editor instead of the custom excerpt box (which is filled out).The problem I have is that I would like my custom excerpt, but it keeps mangling my box wrapper by inserting paragraphs all around in it, causing the box to become broken, which you can see in the link provided to my homepage (staging server on flywheel).
If I call the excerpt on the post type itself, it works as expected. Is there a different method to obtain a custom excerpt on a different page than the post type itself? Or am I simply doing something wrong?
Full code block:
<div class="recent-news-cards"> {% for recent_news in newsletters %} <a class="recent-news-post" href="{{ recent_news.link }}"> <h3>{{ recent_news.title }}</h3> <p>{{ recent_news.preview(20) }}</p> <span class="primary-button--g">Read Story</span> </a> {% endfor %} </div>
The page I need help with: [log in to see the link]
- The topic ‘Custom Post Type get_Preview renders instead of custom excerpt’ is closed to new replies.