Skip Navigation

[Resolved] Post Excerpt in View Needs To Display The Media Player from an Embed

This thread is resolved. Here is a description of the problem and solution.

The user would like to display post excerpts and would like them to render audio players if they contain links to audio files.

The excerpt is always generated as raw data and does not preserve or create any special formatting.
For this use case we use displayed the post body/content and we used custom CSS code to display only the first paragraph. Check this reply

This support ticket is created 2 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by marcusC-4 2 years, 8 months ago.

Assisted by: Jamal.



I am not sure if this is possible, but I'd like for my post excerpt to display the audio player, rather than the link that currently displays.

You can see what I mean on this page: hidden link

If you click on Read More from one of the posts, you will see that the audio player automatically works correctly on the Podcast single page. However, in the View, it just shows the URL, instead of the media player.


UPDATE: I switched to using the post body and now the audio player works as expected, which is great.

However, the body doesn't have an option to limit the character count. So the entire post body is showing and I need to limit it. I have followed the instructions here, but am not having any luck:

Is there another option for limiting the character count for the post body in this View?



Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello and thank you for contacting Toolset support.

The excerpt, unlike the post body, displays raw data and will not initialize the player. The workaround on the other hand seems incomplete to me. Have you added the shortcode code to the theme or in a Toolset snippet?

add_shortcode('limit_content', 'trim_shortcode');
 function trim_shortcode($atts, $content = '') {
    $content = wpv_do_shortcode($content);
    $length = (int)$atts['length'];
    if (strlen($content) > $length) {
        $content = substr($content, 0, $length) . '…';
    // Strip HTML Tags
    $content = strip_tags($content);
    return $content;

If you have already added it to a Toolset snippet, make sure that the snippet is active.

If that does not help, allow me temporary access to your website to check this closely. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **



Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Thank you for the credentials. I can see why the shortcode breaks the layout. Because it removes the closing tags(such as <div>) and that will definitely break the layout.

I tried to create another shortcode that will apply the_content filter to the exceprt, hoping that will generate the audio player, but it did not help.

As a workaround, I thought about a simple CSS solution, assuming that the audio player is always the first in the content. The idea is to display the content but hide all paragraphs except the first one. For that, we need to add a CSS class to the Fields&Text block(my-hide) and add the following CSS code. Check this screenshot hidden link


I hope this is a viable solution for you. Let me know your feedback.

Please note that I added this only to the Podcast content template inside the view's loop. You may need to add it to the other content templates.


Interesting idea to use CSS. I decided to keep what you did, plus add a max-height to the p that is visible and set overflow to hidden. That combination helped truncate it nicely. I can't get a the 3 dots at the end of the text unfortunately, but I think it works out pretty well this way.

Thanks for your help.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.