Skip to main content

Posts

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

Auto suggestion using Ajax, jQuery and PHP

jQuery PHP Ajax Autosuggest Search.html <input type="text" class="searchfield search_keyword"  placeholder="Search For Stocks" id="search_keyword_id">  <div id="result"></div>           <script type="text/javascript" src="//code.jquery.com/jquery-1.8.0.min.js"></script> <script type="text/javascript"> function set_item(x,y,z) {  var c = x+"    "+ y;  $('#search_keyword_id').val(c);  $('#stockcode').val(x);  $('#exchangeId').val(z); } $(function(){ $(".search_keyword").keyup(function() {     var search_keyword_value = $(this).val();     var dataString = 'search_keyword='+ search_keyword_value;     if(search_keyword_value!='')     {         $.ajax({             type: "POST",    ...

Magento: How to select, insert, update, and delete data?

Magento: How to select, insert, update, and delete data? Magento execute custom query to insert data // fetch write database connection that is used in Mage_Core module $write = Mage::getSingleton('core/resource')->getConnection('core_write'); // now $write is an instance of Zend_Db_Adapter_Abstract $write->query("INSERT INTO tablename VALUES ('111','aaa','abc123')"); Execute custom query to fetch data $write = Mage::getSingleton('core/resource')->getConnection('core_write'); // now $write is an instance of Zend_Db_Adapter_Abstract $result = $write->query("SELECT * FROM  `pepitashop_catalog_product_entity` LIMIT 0 , 30 "); while ($row = $result->fetch() ) {  $categoryIds[] = $row['id']; //insert into an array } Getting data into phtml files/view files Method-1 // GETTING DATA FROM ANOTHER METHOD $resource = Mage::getSingleton('core/resource'); $readConnection = $resource-...

Folder download in zip format in php

<?php class zip {    private $zip;    public function __construct( $file_name, $zip_directory)    {         $this->zip = new ZipArchive();         $this->path = dirname( __FILE__ ) . $zip_directory . $file_name . '.zip';         $this->zip->open( $this->path, ZipArchive::CREATE );     }          /**      * Get the absolute path to the zip file      * @return string      */     public function get_zip_path()     {         return $this->path;     }              /**      * Add a directory to the zip      * @param $directory      */ ...

For create custom post type and taxonomy with hierarchical url structure in WordPress

//For create custom post type and taxonomy with hierarchical url structure in WordPress need below plug-in with /%types%/%postname%/ //https://wordpress.org/plugins/custom-post-type-permalinks/  function crunchify_deals_custom_post_type() {  $labels = array(   'name'                => __( 'Deals' ),   'singular_name'       => __( 'Deal'),   'menu_name'           => __( 'Deals'),   'parent_item_colon'   => __( 'Parent Deal'),   'all_items'           => __( 'All Deals'),   'view_item'           => __( 'View Deal'),   'add_new_item'        => __( 'Add New Deal'),   'add_new' ...

Registering Custom Post Type images and Taxonomies

//Registering Custom Post Type images and taxonomies add_action( 'init', 'register_themepost', 20 ); function register_themepost() {     $labels = array(         'name' => _x( 'images', 'my_custom_post','custom' ),         'singular_name' => _x( 'Image', 'my_custom_post', 'custom' ),         'add_new' => _x( 'Add New', 'my_custom_post', 'custom' ),         'add_new_item' => _x( 'Add New ImagePost', 'my_custom_post', 'custom' ),         'edit_item' => _x( 'Edit ImagePost', 'my_custom_post', 'custom' ),         'new_item' => _x( 'New ImagePost', 'my_custom_post', 'custom' ),         'view_item' => _x( 'View ImagePost', 'my_custom_post', 'custom' ),         'search_items' =>...

WordPress Resize Thumbnail Image

<?php //WordPress Resize Thumbnail Image //aq_resizer.php /**  * Title         : Aqua Resizer  * Description   : Resizes WordPress images on the fly  * Version       : 1.1.7  * Author        : Syamil MJ  * Author URI    : http://aquagraphite.com  * License       : WTFPL - http://sam.zoy.org/wtfpl/  * Documentation : https://github.com/sy4mil/Aqua-Resizer/  *  * @param string  $url    - (required) must be uploaded using wp media uploader  * @param int     $width  - (required)  * @param int     $height - (optional)  * @param bool    $crop   - (optional) default to soft crop  * @param bool    $single - (optional) returns an array if false  * @uses  wp_upload_dir()  * @uses  image_resize_dimensions() | image_resize()  * @uses  ...

Video Play in background image

Video Play in background image <style> body {   margin: 0;   background: #000; } video {     position: fixed;     top: 50%;     left: 50%;     min-width: 100%;     min-height: 100%;     width: auto;     height: auto;     z-index: -100;     transform: translateX(-50%) translateY(-50%);  background: url('//demosthenes.info/assets/images/polina.jpg') no-repeat;   background-size: cover;   transition: 1s opacity; } .stopfade {    opacity: .5; } #polina {   font-family: Agenda-Light, Agenda Light, Agenda, Arial Narrow, sans-serif;   font-weight:100;   background: rgba(0,0,0,0.3);   color: white;   padding: 2rem;   width: 33%;   margin:2rem;   float: right;   font-size: 1.2rem; } h1 {   font-size: 3rem;   text-transform: uppercase;   margin-top: 0;   letter-s...