Skip to main content

Posts

Showing posts from March, 2018

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,

Crurl in php in live server

global $product; $current_user = wp_get_current_user(); $useriid = $current_user->data->ID; $meta = get_user_meta( $useriid ); if($bpid == ""){ $productid = implode('-',$spid); $pdfcode = $spid[0]; }else{ $productid = $bpid; $pdfcode = $bpid; } $text = "demo".$order_id."-".$pdfcode."-1"; $url ='http://www.demo.in/wp-content/themes/wisdomstore/dompdf/barcode.php'; $fields = array( 'text'  => $text, ); //open connection $server = '103.195.184.60'; $host   = 'thewisdomstore.in'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $server); /* set the user agent - might help, doesn't hurt */ curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)'); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); /* try to follow redirects */ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); /* timeout after the specified number of seconds. as

Create admin settings in wp

<?php /* Plugin Name: Demo SMS Plugin URI: http://myasa.net Description: This plugin will integrate Demo SMS API Author: Sheikh Aamir Wahid Version: 1.0 Author URI: https://github.com/aamirwahid5 */ ob_start(); //include "functions.php"; add_action('admin_menu', function() {     add_options_page( 'SMS Settings', 'Demo SMS', 'manage_options', 'mobi-sms-plugin', 'mobiSMS_plugin_page' ); }); add_action( 'woocommerce_order_status_pending', 'mysite_pending', 10, 1); add_action( 'woocommerce_order_status_failed', 'mysite_failed', 10, 1); add_action( 'woocommerce_order_status_on-hold', 'mysite_hold', 10, 1); // Note that it's woocommerce_order_status_on-hold, and NOT on_hold. add_action( 'woocommerce_order_status_processing', 'mysite_processing', 10, 1); add_action( 'woocommerce_order_status_completed', 'mysite_completed', 10, 1);

Create post with all post type

<?php /* add_action( 'wp_enqueue_scripts', 'mpcth_child_enqueue_scripts', 1000 ); function mpcth_child_enqueue_scripts() { wp_enqueue_style( 'mpc-styles-child', get_stylesheet_directory_uri() . '/style_custom.css' ); } */ function registration_form( $username, $fname, $lname, $email, $password, $confirm_password, $account_type, $distict_city, $school_name ,$school_address, $school_type, $grade_level, $invcode ) { ?>     <style>       /* Always set the map height explicitly to define the size of the div        * element that contains the map. */     #map {     height: 260px; }     </style>   <script> function initMap() {     var map = new google.maps.Map(document.getElementById('map'), {       center: {lat: -33.8688, lng: 151.2195},       zoom: 13     });     var input = document.getElementById('searchInput');    // map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);