WordPress.org

Ready to get started?Download WordPress

Forums

WP Parallax Content Slider
Video support in slider (5 posts)

  1. axiomz
    Member
    Posted 1 year ago #

    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/

  2. wp-maverick
    Member
    Plugin Author

    Posted 1 year ago #

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

  3. axiomz
    Member
    Posted 1 year ago #

    Hi,

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

  4. wp-maverick
    Member
    Plugin Author

    Posted 1 year ago #

    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)

  5. axiomz
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.