Skip to main content

Get Google Calendar Event List in WordPress

<a href="https://console.cloud.google.com/apis/credentials">Get Your Api Credentials Here</a> <a href="https://calendar.google.com/calendar">Get your Calender ID</a> <?php include_once("wp-load.php"); function  get_calender_events() { $params = array(); /*Get current date*/ $current_date  = date('Y-m-d H:i:s'); /*Convert it to google calendar's rfc_format */ $rfc_format = date("c", strtotime($current_date)); $params[] = 'orderBy=startTime'; $params[] ='maxResults=100'; $params[] = 'timeMin='.urlencode($rfc_format); $url_param = ''; foreach($params as $param) { $url_param.= '&'.$param; } $calender_id = "calender_id"; $client_key =  "client_key"; $url = "https://www.googleapis.com/calendar/v3/calendars/".$calender_id."/events?key=".$client_key."&singleEvents=true".$url_param; $list_events = wp_remote_post($url, ...

YouTube Video slider

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://bxslider.com/lib/jquery.bxslider.min.js"></script>
<script>
$(document).ready(function(){
  $('.slider1').bxSlider({
slideWidth: 200,
minSlides: 1,
maxSlides: 3,
slideMargin: 10,
auto: false,
pager: true,
pagerSelector: '#bx-pager',
//pagerCustom: '#bx-pager-custom',
infiniteLoop: true,
easing: 'easeOutElastic',
speed: 2000,
nextSelector: '#slider-nextw',
prevSelector: '#slider-prevw',
nextText: 'Onward →',
prevText: '← Go back'
  });
});
$(document).ready(function(){
$(".video-1").on("click", function(event) {
//var callss=this.id;
//alert(callss);
  event.preventDefault();
  $(".video_case iframe").prop("src", $(event.currentTarget).attr("href"));
});});
</script>
<style>
.playbutton {
    background: url('http://www.ams4cme.com/www/Images/PlayButton-Small.png') center center no-repeat;
    position: absolute;
    top: 50%;
    left: 35%;
    width: 74px;
    height: 74px;
    margin: -35px 0 0 -35px;
    z-index: 10;
    opacity:0.6;
}
.playbutton:hover {
    opacity:1.0;
}

</style>

<div class="video_case">
    <iframe width="560" height="315" src="http://www.youtube.com/embed/WY32nnKrB70" frameborder="0" allowfullscreen></iframe>
</div>
<div class="slider1">
  <div class="slide">
 
  <a href="http://www.youtube.com/embed/WY32nnKrB70" class="video-1" title="" ><img src="http://img.youtube.com/vi/WY32nnKrB70/hqdefault.jpg" alt="" width="150"/><span class="playbutton"></span></a></div>
   <div class="slide"><a href="http://www.youtube.com/embed/TtCmsRy4r70" class="video-1" title="" ><img src="http://img.youtube.com/vi/TtCmsRy4r70/hqdefault.jpg" alt="" width="150"/><span class="playbutton"></span></a></div>
    <div class="slide"><a href="http://www.youtube.com/embed/vNzwZ9oKezo" class="video-1" title="" ><img src="http://img.youtube.com/vi/vNzwZ9oKezo/hqdefault.jpg" alt="" width="150"/><span class="playbutton"></span></a></div>
   <div class="slide"><a href="http://www.youtube.com/embed/sWf3bEmCqok" class="video-1" title=""><img src="http://img.youtube.com/vi/sWf3bEmCqok/hqdefault.jpg" alt="" width="150"/><span class="playbutton"></span></a></div>
   <div class="slide"><a href="http://www.youtube.com/embed/rPNAG8Q_0V4" class="video-1" title="" ><img src="http://img.youtube.com/vi/rPNAG8Q_0V4/hqdefault.jpg" alt="" width="150"/><span class="playbutton"></span></a></div>

</div>
<div class="outside">
  <span id="slider-prevw"></span>
  <div id="bx-pager"></div>
  <span id="slider-nextw"></span>
</div>
<div id="bx-pager-custom">
  <a data-slide-index="0" href=""><img src="/images/thumbs/tree_root.jpg" /></a>
  <a data-slide-index="1" href=""><img src="/images/thumbs/houses.jpg" /></a>
  <a data-slide-index="2" href=""><img src="/images/thumbs/hill_fence.jpg" /></a>
</div>
---------------------------------------------------------------------------
<script type="text/javascript">
function youtubeFeedCallback(data) {
    document.writeln('<img src="' + data.entry["media$group"]["media$thumbnail"][0].url + '" width="' + data.entry["media$group"]["media$thumbnail"][0].width + '" height="' + data.entry["media$group"]["media$thumbnail"][0].height + '" alt="Default Thumbnail" align="right"/>');
    document.writeln('<b>Title:</b> ' + data.entry["title"].$t + '<br/>');
    document.writeln('<b>Author:</b> ' + data.entry["author"][0].name.$t + '<br/>');
    document.writeln('<b>Published:</b> ' + new Date(data.entry["published"].$t.substr(0, 4), data.entry["published"].$t.substr(5, 2) - 1, data.entry["published"].$t.substr(8, 2)).toLocaleDateString() + '<br/>');
    document.writeln('<b>Duration:</b> ' + Math.floor(data.entry["media$group"]["yt$duration"].seconds / 60) + ':' + (data.entry["media$group"]["yt$duration"].seconds % 60) + ' (' + data.entry["media$group"]["yt$duration"].seconds + ' seconds)<br/>');
    document.writeln('<b>Rating:</b> ' + new Number(data.entry["gd$rating"].average).toFixed(1) + ' out of ' + data.entry["gd$rating"].max + '; ' + data.entry["gd$rating"].numRaters + ' rating(s)' + '<br/>');
    document.writeln('<b>Statistics:</b> ' + data.entry["yt$statistics"].favoriteCount + ' favorite(s); ' + data.entry["yt$statistics"].viewCount + ' view(s)' + '<br/>');
    document.writeln('<br/>' + data.entry["media$group"]["media$description"].$t.replace(/\n/g, '<br/>') + '<br/>');
    document.writeln('<br/><a href="' + data.entry["media$group"]["media$player"].url + '" target="_blank">Watch on YouTube</a>');
}
</script>
<script type="text/javascript" src="http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&amp;alt=json-in-script&amp;callback=youtubeFeedCallback"></script>

Comments

Popular posts from this blog

Create Signature pad with save on database in php

Create Signature pad with save on database in php 1.create a folder images index.php ============   <!DOCTYPE >     <head>     <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />     <title>Signature Pad</title>     <script type="text/javascript" src="jquery-1.8.0.min.js"></script>     <script type="text/javascript"> $(document).ready(function () {     /** Set Canvas Size **/     var canvasWidth = 400;     var canvasHeight = 100;     /** IE SUPPORT **/     var canvasDiv = document.getElementById('signaturePad');     canvas = document.createElement('canvas');     canvas.setAttribute('width', canvasWidth);     canvas.setAttribute('height', canvasHeight);     canvas.setAttribute('id', 'canvas');     canvasDiv.appendChild(canvas);    ...

Get Google Calendar Event List in WordPress

<a href="https://console.cloud.google.com/apis/credentials">Get Your Api Credentials Here</a> <a href="https://calendar.google.com/calendar">Get your Calender ID</a> <?php include_once("wp-load.php"); function  get_calender_events() { $params = array(); /*Get current date*/ $current_date  = date('Y-m-d H:i:s'); /*Convert it to google calendar's rfc_format */ $rfc_format = date("c", strtotime($current_date)); $params[] = 'orderBy=startTime'; $params[] ='maxResults=100'; $params[] = 'timeMin='.urlencode($rfc_format); $url_param = ''; foreach($params as $param) { $url_param.= '&'.$param; } $calender_id = "calender_id"; $client_key =  "client_key"; $url = "https://www.googleapis.com/calendar/v3/calendars/".$calender_id."/events?key=".$client_key."&singleEvents=true".$url_param; $list_events = wp_remote_post($url, ...

WooCommerce Mini cart With Ajax

WooCommerce Mini cart //MINI CART SECTION   <div class="productdiv rightcart">                                                         <?php if ( ! WC()->cart->is_empty() ) : ?>     <ul class="woocommerce-mini-cart cart_list product_list_widget <?php echo esc_attr( $args['list_class'] ); ?>">         <?php             do_action( 'woocommerce_before_mini_cart_contents' );             foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {                 $_product     = apply_filters( 'woocommerce_cart_item_pro...