WordPress.org

Ready to get started?Download WordPress

Forums

Viper's Video Quicktags
Vipers video tags with Advanced Excerpt (2 posts)

  1. cabbio540
    Member
    Posted 2 years ago #

    Hello, I was wondering if it was possible to use the plugin with the wordpress excerpt function, and if so can it be done with the Advanced Excerpt plugin. I have searched and noticed others with the same problem but have not come to a conclusion yet.

    The problem I am having is with youtube videos only displaying the thumbnail in the excerpt.

    I have had a bit of success using a custom excerpt, using the guide from http://aaronrussell.co.uk/legacy/improving-wordpress-the_excerpt/

    and also have had success using http://heera.it/show-vipers-video-excerpt , however neither of these options allow me the flexibility of the advanced excerpt plugin. I am quite new to wordpress and PHP, so cant get my head around creating a custom excerpt, that allows videos from viper quick tags and all other html.

    Thanks for any help in advance,

    Simon

    http://wordpress.org/extend/plugins/vipers-video-quicktags/

  2. cabbio540
    Member
    Posted 2 years ago #

    I've managed to solve the problem of using videos with the excerpts using help from the http://aaronrussell.co.uk/legacy/improving-wordpress-the_excerpt/

    Before when I had it i had some custom excerpts which is why it was not showing unfortunately, stupid me. I had to alter the code slightly to the example given which is as follows...

    Place in the functions.php file of your theme and turn off and excerpt plugins.

    // Better excerpts to show the videos and solve the youtube issue.
    function improved_trim_excerpt($text) {
            global $post;
            if ( '' == $text ) {
                    $text = get_the_content('');
                    $text = apply_filters('the_content', $text);
                    $text = str_replace('\]\]\>', ']]>', $text);
                    $text = strip_tags($text, '<p><script><div><span><embed><object><iframe><img>');
                    $excerpt_length = 100;
                    $words = explode(' ', $text, $excerpt_length + 1);
                    if (count($words)> $excerpt_length) {
                            array_pop($words);
                            array_push($words, '...');
                            $text = implode(' ', $words);
                    }
            }
            return $text;
    }
    
    remove_filter('get_the_excerpt', 'wp_trim_excerpt');
    add_filter('get_the_excerpt', 'improved_trim_excerpt');

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic