WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Viper's Video Quicktags] Same post, differnet size videos on different pages (4 posts)

  1. Drew Baker
    Member
    Posted 4 years ago #

    Hey Viper,

    I want to display my videos on the front page (index.php) at 300px wide, but have them 500px when viewing a single post (single.php). Is there a way to view the same video at different sizes?

    Your changelog says that version v6.1.2 added a filter that lets themes resize videos automatically. Would that do it? If so, how? I'm hoping for something similar to the_post_thumb feature.

    Thanks!

  2. Try this something like this in your theme's functions.php:

    add_filter( 'vvq_shortcodeatts', 'dbaker_vvq_modifier', 10, 3 );
    
    function dbaker_vvq_modifier( $atts, $tag, $rawatts ) {
    	if ( is_singular() ) {
    		$atts['width'] = 500;
    		$atts['height'] = 375;
    	}
    
    	return $atts;
    }

    That'll override the width/height in singular views (posts and pages).

  3. Drew Baker
    Member
    Posted 4 years ago #

    Viper,
    This is great! Thanks.

    Is there a way to use it twice to allow more sizes? I tried just doubling it up and changing the modifier name, but it doesn't work like that I suppose.

    As a side note, this would be a good note to add into the FAQ on the Plugin page.

    Thanks!

  4. Add more conditionals inside of the function.

    http://codex.wordpress.org/Conditional_Tags

Topic Closed

This topic has been closed to new replies.

About this Topic