WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WP Parallax Content Slider] Video support in slider

[Plugin: WP Parallax Content Slider] Video support in slider

  • axiomz
    Member

    @axiomz

    Hi,

    Great plugin! I managed to completely noob hacked this to show videos on each slide instead of a thumbnail (if the post contains a video).

    functions.php
    //added this

    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    //see if video exist and get ID (youtube only)
    $videoput = preg_match_all('#https?://www\.youtube(?:\-nocookie)?\.com/[ve]/([A-Za-z0-9\-_]+)#', $post->post_content, $matches2);
    
      $first_vid = $matches2 [1] [0];
      $first_img = $matches [1] [0];
    
      if(empty($first_img)){ //Defines a default image
        $first_img = "http://www.zamzamacademy.com/wp-content/themes/arthemia-premium/images/default2.png";
      }
    
      if(empty($first_vid)) {
         $getcodetag ="<img src=".$first_img." width=127 height=130 />";
    	}
    	else {
    	  $getcodetag ="<iframe class=slideriframe width=127 height=130 src=http://www.youtube.com/embed/".$first_vid." frameborder=0 allowfullscreen></iframe>";
    	}

    ————————–
    wp-parallax-content-slider.php
    //Changed $outputSlide to:
    $outputSlide .= "<div class='da-img'>".catch_that_image()." </div>"."\n";

    This works for me, but there is definitely a better way of doing it.

    http://wordpress.org/extend/plugins/wp-parallax-content-slider/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author wp-maverick
    Member

    @wp-maverick

    Hi axiomz,
    can I see your customized plugin somewhere? That’s a good idea!

    axiomz
    Member

    @axiomz

    Hi,

    Sure. It is on the homepage here:
    http://www.zamzamacademy.com

    Plugin Author wp-maverick
    Member

    @wp-maverick

    Thanks, that’s great! I’ll try to add this as a feature in a future version. Maybe a parameter to choose what to display: 1 – featured image (default image if no featured image), 2 – video (if there is one in the post)

    axiomz
    Member

    @axiomz

    That sounds perfect. Though, one thing that might come up is if you click play on the video, the current slide should pause.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP Parallax Content Slider] Video support in slider’ is closed to new replies.