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, ...

Smarty tweaks

/*-----------------------Smarty Tweaks-----------------------*/

$sql_main = "SELECT * FROM Main";   
    $main = $obj->MySQLSelect($sql_main);
------------------------------------------------------------------
<div class="inputboxes">
                                     
                                                       
            <label for="textfield"><strong>Select Main :</strong></label>
                                 
            <select id="mainID" name="Data[mainID ]"  lang="*" title="mainID">
                <option value=''>--Select Main--</option>
                {section name=i loop=$main}
                <option value="{$main[i]['mainID']}" {if $db_transaction[0].mainID eq $main[i].mainID}selected{/if} >{$main[i]['business_name']}</option>
                    {/section}
             
            </select>
                                     
                                     
      </div>
     
     
     
      -------------------------------
      $sqlBusinessCat = "select * from Main";
    $db_businesscat = $obj->MySQLSelect($sqlBusinessCat);
   
    #$sqlBusinessCity="select * from state_master";
    #$db_businesscity = $obj->MySQLSelect($sqlBusinessCity);
   
    $sqlBusinessCont="select * from  country_master";
    $db_businesscont = $obj->MySQLSelect($sqlBusinessCont);
   
   

    $smarty->assign("db_businesscont",$db_businesscont);

    #$smarty->assign("db_businesscity",$db_businesscity);
    $smarty->assign("db_businesscat",$db_businesscat);
   
    -------------------------------------------------------------------
   
   
    astatelist.php
    --------------------
    <?php

$countryId= $_REQUEST['countryId'];
$selectedstate = $_REQUEST['selectedstate'];
$sql = "select * from state_master where vCountryCode='".$countryId."' AND eStatus='Active'";

$db_businesscity = $obj->MySQLSelect($sql);

if($countryId !=''){
    if(count($db_businesscity) > 0){
      $html = '';
  $html .= '<select name="Data[province]" id="province" class="select_input">';
  $html .= '<option value="">----select state----</option>';
  for($i=0;$i<count($db_businesscity);$i++){
            if($iStateId == $db_businesscity[$i]['iStateId']){
                $selected = "selected";
            }else{
                $selected = "";
            }
            if($selectedstate !=''){
                if($selectedstate == $db_businesscity[$i]['vState']){
                    $selected = "selected";
                }else{
                    $selected = "";
                }
            }
            $html .= '<option value="'.$db_businesscity[$i]['vState'].'" '.$selected.'>'.$db_businesscity[$i]['vState'].'</option>';
        }
      $html .= '<select>';
    }else{
        $html .= '<select name="Data[province]" id="province" class="select_input">';
            $html .= '<option value="">----select state----</option>';
        $html .= '<select>';   
    }
   
}else{
     $html .= '<select name="Data[province]" id="province" class="select_input">';
            $html .= '<option value="">----select state----</option>';
        $html .= '<select>';   
}
echo $html;exit;

?>
--------------------------------
<input type="hidden" name="selectedstate" id="selectedstate" value="{$db_business[0].province}">
               
                <input type="hidden" name="action" id="action" value="{$mode}" />
                <div class="inputboxes">
                    <label for="textfield"><strong>Main Id:</strong></label>
                    <select id="mainID" name="Data[mainID]"   title="mainID" lang="*">
                        <option value=''>--Select main ID--</option>
                        {section name=i loop=$db_businesscat}
                        <option value='{$db_businesscat[i].mainID}' {if $db_businesscat[i].mainID eq $db_business[0].mainID}selected{/if}>{$db_businesscat[i].business_name}</option>
                        {/section}
                       
                    </select>
                    <!--<input type="text" id="vNewCategory" name="vNewCategory" class="inputbox" title="New Category" style="display:none;"/>-->
                </div>
               
               
               
               
               
                <div class="inputboxes">
                    <label for="textfield"><strong>Country:</strong></label>
                    <select id="iCountryId" name="Data[country]"   title="CountryId" lang="*" onchange="getStates(this.value);">
                        <option value=''>--Select Country --</option>
                        {section name=i loop=$db_businesscont}
                        <option value='{$db_businesscont[i].vCountryCode}' {if $db_businesscont[i].vCountryCode eq $db_business[0].country}selected{/if}>{$db_businesscont[i].vCountry}</option>
                        {/section}
                       
                    </select>
                   
                </div>
                 <div class="inputboxes">
                    <label for="textfield"><strong>Province:</strong></label>
                    <div class="showallstates">
                    <select id="province" name="Data[province]"   title="province" lang="*">
                        <option value=''>--Select State --</option>
                    </select>
                     </div>
                </div>
               
                <script>
function redirectcancel(){
    var admin_url = '{/literal}{$admin_url}{literal}';
    var file = 'bu-business';
   // alert(admin_url+"/index.php?file=u-user&mode=view");
    window.location=admin_url+"/index.php?file=bu-business&mode=view";
    return false;
}
var mode = '{/literal}{$mode}{literal}';
if(mode == 'edit'){
    var countryId = '{/literal}{$db_business[0].country}{literal}';
    getStates(countryId);
}
</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...