11

Show Video In Excerpt

A few days ago I’ve developed a WordPress site and used Viper’s Video Quicktags plugin. The plugin works fine and it’s really awesome but on my site I wanted to use WordPress’ the_excerpt function instead of the_content and also I was trying to show video clips on my index page and that was a problem, not with the plugin but the_excerpt function strips out all HTML tags and doesn’t show video clips and basically it was built to show only the first 55 characters by default. So I’ve searched the Google and didn’t find any easy solution then I’ve tried to do something by myself and finally I’ve solved it using WordPress’s hook on the_excerpt. I’ve used the ‘the_excerpt’ filter and now it’s working fine. Here is the example I’m using in my functions.php file to filter ‘the_excerpt’ function.

Here is the live example.

Above code snippet solved my problem and videos are visible within the_excerpt function. Hope this one will help someone and if there is anything else better than this please let me know. Thanks!

Latest Blog