RSS not supported?
-
How do I get the video post in the rss feed?
-
Hi,
Create a file in the name “rss.php” witht the following content and save it in the following path wp-content\plugins\contus-video-gallery\rss.php.
<?php require_once( dirname(__FILE__) . '/hdflv-config.php'); $pageOBJ = new ContusVideoView(); ## include class from Videohome view $contOBJ = new ContusVideoController(); ## include class from Videohome controller $numberofvideos = 100; ## Get number of videos from URL $getVid = filter_input(INPUT_GET, 'vid'); ## Get video ID from video home view $getPid = filter_input(INPUT_GET, 'playid'); ## Get playlist ID from video home view $type = filter_input(INPUT_GET, 'type'); if (!empty($type) && $type === 'popular') { ## IF type = popular video $thumImageorder = 'w.hitcount DESC'; $where = ''; $singleVideodata = $contOBJ->home_playxmldata($thumImageorder, $where, $numberofvideos); } else if (!empty($type) && $type === 'recent') { ## IF type = recent video $thumImageorder = 'w.vid DESC'; $where = ''; $singleVideodata = $contOBJ->home_playxmldata($thumImageorder, $where, $numberofvideos); } else if (!empty($type) && $type === 'featured') { ## IF type = featured video $thumImageorder = 'w.ordering ASC'; $where = 'AND w.featured=1'; $singleVideodata = $contOBJ->home_playxmldata($thumImageorder, $where, $numberofvideos); } else if (!empty($getVid)) { $singleVideodata = $contOBJ->videodetail($getVid); ## Get detail for particular video } else if (!empty($getPid)) { $singleVideodata = $contOBJ->video_Pid_detail($getPid); ## Get detail for particular playlist } else { $singleVideodata = $pageOBJ->_featuredvideodata; ## Get detail of featured videos } ob_clean(); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("content-type: text/xml"); echo '<?xml version="1.0" encoding="utf-8"?>'; echo '<rss xmlns:content="https://purl.org/rss/1.0/modules/content/" version="2.0">'; $siteName = get_bloginfo('name'); echo '<title>'.$siteName.'</title>'; echo '<link>'.get_bloginfo('url').'</link>'; $dir = dirname(plugin_basename(__FILE__)); $dirExp = explode('/', $dir); $dirPage = $dirExp[0]; $image_path = str_replace('plugins/'.$dirPage.'/', 'uploads/videogallery/', APPTHA_VGALLERY_BASEURL); if (count($singleVideodata) > 0) { foreach ($singleVideodata as $media) { $file_type = $media->file_type; $videoUrl = $media->file; $opimage = $media->opimage; $image = $media->image; $fbPath = $media->guid; ## Get thumb image detail if ($image == '') { $image = $pageOBJ->_imagePath . 'nothumbimage.jpg'; } else { if ($file_type == 2) { $image = $image_path . $image; } } ## Get preview image detail if ($opimage == '') { $opimage = $pageOBJ->_imagePath . 'noimage.jpg'; } else { if ($file_type == 2) { $opimage = $image_path . $opimage; } } ## Get video url detail if ($videoUrl != '') { if ($file_type == 2) { $videoUrl = $image_path . $videoUrl; } } $title = htmlspecialchars($media->name); $views = $media->hitcount; $date = date("m-d-Y", strtotime($media->post_date)); echo '<item>'; echo '<videoId>' . $media->vid . '</videoId>'; echo '<videoUrl>' . $videoUrl . '</videoUrl>'; echo '<thumbImage>' . $image . '</thumbImage>'; echo '<previewImage>' . $opimage . '</previewImage>'; echo '<views>' . $views . '</views>'; echo '<createdDate>' . $date . '</createdDate>'; echo '<title>'; echo '<![CDATA[' . $title . ']]>'; echo '</title>'; echo '<description>'; echo '<![CDATA[' . $media->description . ']]>'; echo '</description>'; echo '<tags>'; echo '<![CDATA[' . $rows->tags_name . ']]>'; echo '</tags>'; echo '<link>' . $fbPath . '</link>'; echo '<generator>Video_Gallery_Feed</generator>'; echo '<docs>https://blogs.law.harvard.edu/tech/rss</docs>'; echo '</item>'; } } echo '</rss>'; exit(); ?>
Now open \wp-content\plugins\contus-video-gallery\front\models\videohome.php and add the following function inside the class.
public function get_videodetail($vid) {//function for getting Tag name starts global $wpdb; $video_count = $this->_wpdb->get_results("SELECT t1.vid,t1.description,t4.tags_name,t1.name,t1.post_date,t1.image,t1.file,t1.hitcount,t1.ratecount,t1.file_type,t1.embedcode,t1.rate,t2.playlist_id,t3.playlist_name" . " FROM " . $this->_videoinfotable . " AS t1" . " LEFT JOIN " . $wpdb->prefix . "hdflvvideoshare_med2play AS t2" . " ON t2.media_id = t1.vid" . " LEFT JOIN " . $wpdb->prefix . "hdflvvideoshare_playlist AS t3" . " ON t3.pid = t2.playlist_id" . " LEFT JOIN " . $wpdb->prefix . "hdflvvideoshare_tags AS t4" . " ON t1.vid = t4.media_id" . " WHERE t1.publish='1' AND t3.is_publish='1' AND t1.vid='" . intval($vid) . "' LIMIT 1"); return $video_count; }//function for getting Tag name ends
Open wp-content\plugins\contus-video-gallery\front\controllers\videohomeController.php and add the following function.
function videodetail($vid) {// HOME PAGE player VIDEOS STARTS return $this->get_videodetail($vid); }
Now find the below function in the same file.
function home_playxmldata($getVid,$thumImageorder,$where,$dataLimit) {// HOME PAGE FEATURED VIDEOS STARTS return $this->get_playxmldata($getVid,$thumImageorder,$where,$dataLimit); }
and replace with the following one.
function home_playxmldata($thumImageorder,$where,$dataLimit) {// HOME PAGE FEATURED VIDEOS STARTS return $this->get_playxmldata($thumImageorder,$where,$dataLimit); }
2) Find the below code in the following path \wp-content\plugins\contus-video-gallery\front\models\videohome.php
public function get_playxmldata($getVid,$thumImageorder,$where,$numberofvideos) { ##function for getting settings data starts $videoid = $getVid; $query = "SELECT distinct w.*,s.guid,p.playlist_name,p.pid FROM " . $this->_videoinfotable. " w INNER JOIN " . $this->_wpdb->prefix . "hdflvvideoshare_med2play m ON m.media_id = w.vid INNER JOIN " . $this->_wpdb->prefix . "hdflvvideoshare_playlist p ON p.pid=m.playlist_id INNER JOIN " . $this->_wpdb->prefix . "posts s ON s.ID=w.slug WHERE w.publish='1' AND p.is_publish='1' AND w.vid=$videoid GROUP BY w.vid"; $rows = $this->_wpdb->get_results($query); if (count($rows) > 0) { $query = "SELECT distinct w.*,s.guid,p.playlist_name,p.pid FROM " . $this->_videoinfotable. " w INNER JOIN " . $this->_wpdb->prefix . "hdflvvideoshare_med2play m ON m.media_id = w.vid INNER JOIN " . $this->_wpdb->prefix . "hdflvvideoshare_playlist p ON p.pid=m.playlist_id INNER JOIN " . $this->_wpdb->prefix . "posts s ON s.ID=w.slug WHERE w.publish='1' AND p.is_publish='1' $where AND w.vid != $videoid ORDER BY $thumImageorder LIMIT ".($numberofvideos-1); $playlist = $this->_wpdb->get_results($query); ## Array rotation to autoplay the videos correctly $arr1 = array(); $arr2 = array(); if(count($playlist) > 0){ foreach($playlist as $r): if($r->vid > $rows[0]->vid){ ##Storing greater values in an array $query = "SELECT distinct w.*,s.guid,p.playlist_name,p.pid FROM " . $this->_videoinfotable. " w INNER JOIN " . $this->_wpdb->prefix . "hdflvvideoshare_med2play m ON m.media_id = w.vid INNER JOIN " . $this->_wpdb->prefix . "hdflvvideoshare_playlist p ON p.pid=m.playlist_id INNER JOIN " . $this->_wpdb->prefix . "posts s ON s.ID=w.slug WHERE w.publish='1' AND p.is_publish='1' AND w.vid=$r->vid "; $arrGreat = $this->_wpdb->get_row($query); $arr1[] = $arrGreat; }else{ ##Storing lesser values in an array $query = "SELECT distinct w.*,s.guid,p.playlist_name,p.pid FROM " . $this->_videoinfotable. " w INNER JOIN " . $this->_wpdb->prefix . "hdflvvideoshare_med2play m ON m.media_id = w.vid INNER JOIN " . $this->_wpdb->prefix . "hdflvvideoshare_playlist p ON p.pid=m.playlist_id INNER JOIN " . $this->_wpdb->prefix . "posts s ON s.ID=w.slug WHERE w.publish='1' AND p.is_publish='1' AND w.vid=$r->vid "; $arrLess = $this->_wpdb->get_row($query); $arr2[] = $arrLess; } endforeach; } $playlist = array_merge($rows,$arr1,$arr2); } return $playlist; } ##function for getting settings data ends
and replace with the below code.
public function get_playxmldata($thumImageorder,$where,$numberofvideos) { ##function for getting settings data starts $query = "SELECT distinct w.*,s.guid,p.playlist_name,p.pid FROM " . $this->_videoinfotable. " w INNER JOIN " . $this->_wpdb->prefix . "hdflvvideoshare_med2play m ON m.media_id = w.vid INNER JOIN " . $this->_wpdb->prefix . "hdflvvideoshare_playlist p ON p.pid=m.playlist_id INNER JOIN " . $this->_wpdb->prefix . "posts s ON s.ID=w.slug WHERE w.publish='1' AND p.is_publish='1' $where ORDER BY $thumImageorder LIMIT ".($numberofvideos-1); $playlist = $this->_wpdb->get_results($query); return $playlist; } ##function for getting settings data ends
3. Now place the following code where ever you want to display rssfeed link in your site.
<a href="”<?php">” id=”rssfeed” target=”_blank” >RSS Feed</a>
To get particular category details – YOUR_SITE_URL/wp-content/plugins/contus-video-gallery/rss.php?playid=3
To get particular video detail – YOUR_SITE_URL/wp-content/plugins/contus-video-gallery/rss.php?vid=2
To get featured videos – YOUR_SITE_URL/wp-content/plugins/contus-video-gallery/rss.php?type=featured
To get popular videos – YOUR_SITE_URL/wp-content/plugins/contus-video-gallery/rss.php?type=popular
To get recent videos – YOUR_SITE_URL/wp-content/plugins/contus-video-gallery/rss.php?type=recent
If you have any other queries feel free to contact us.
- The topic ‘RSS not supported?’ is closed to new replies.