Archived topic
Display full excerpt of CPT's in archive/search results (no "read more")
7 replies · Started by Morgan on July 25, 2019
I searched and found a lot of related stuff, but a lot was years old, also need some guidance, and am hoping my need is simpler than most other solutions I saw!
I want to show the full text of my FAQ CPT's in archive and search results, without the read-more-button (mine's labeled "read"). All my CPT FAQ's are short so wont break layout. At the moment the only ones needing a button are over the 32 word count (which I want to keep for other post types) by about a sentence.
Hi there,
Try this:
add_filter( 'generate_show_excerpt', function( $show ) {
if ( is_post_type_archive( 'your_faq_post_type_name' ) || ( is_search() && 'your_faq_post_type_name' === get_post_type() ) ) {
return false;
}
return $show;
} );
Let me know :)
Yep, nailed it! :)
Awesome :)
Forgot something!
Would this be the best place to ask/is-it-possible to add a link at bottom of all helpie_faq content with this same filter, or somesuch?
Would be the same link on all FAQ pages sinply linking back to the FAQ dashboard.
You could:
1. Create a Hook Element: https://docs.generatepress.com/article/hooks-element-overview/
2. Set the hook to after_content
3. Add your content into the Hook content area.
4. Set your Display Rules so your hook displays on single FAQ entries.
Oh wow, that's so simple and powerful - I'm starting to get it by jove!
For any dropping by - it first appeared below where I'd placed the "share" buttons from https://wordpress.org/plugins/gp-social-share-svg/ on same hook, so I changed the priority of the Element to 1, and now it loads above Share buttons. Huzzah!
Seeing more in drop-down than at: https://docs.generatepress.com/article/hooks-visual-guide/ , does it need an update?
Thanks again and this officially resolved!
No problem! :)