Add “Show more / Show less” for images in posts and comments (same as for long text)
Hi!
I’d like to limit the height of images in posts and comments (especially screenshots) and add a “Show more / Show less” toggle below them — exactly the same way as it works for long text posts (where “Show more” appears automatically).
I tried using a custom JavaScript snippet in the site footer, but since FluentCommunity loads content dynamically, it doesn’t seem to trigger after posts/comments are rendered.
Could you please tell me which event or hook I can use to run custom JavaScript after posts or comments are rendered in the feed?
Thank you!
I agree. We have some long Welcome messages for the spaces that would be better pinned but then you can't really see the rest of the feed.
FluentCommunity uses these custom events
fcom:feed:rendered- When a feed post is renderedfcom:comment:added- When a comment is added
This is what I use to disable/remove truncate
/**
* FluentCommunity - Disable Show More Feature
*
* Removes the "Show More" button and collapsed view from all feed posts.
* Posts will display at their full height without truncation.
*/
add_action('wp_head', 'fluentcommunity_disable_showmore');
function fluentcommunity_disable_showmore() {
?>
<style id="fcom-showmore-disable">
.feed .btn_expand,
.feed_is_overflow_content .btn_expand {
display: none !important;
}
.feed .feed_body,
.feed_is_overflow_content .feed_body {
max-height: none !important;
overflow: visible !important;
}
</style>
<?php
}