Top Questions

  • 2.11 Years

    • Category : Wordpress
    • Location : Chandigarh, India
    • Posted On : Feb 13, 2019

    Disable default wp-cron.php behavior We can easily tell WordPress to let us handle the execution of wp-cron.php with the wp-config.php file.

    Open your wp-config.php file with the cPanel File Manager Code Editor
    
    Go to the bottom of the database settings in wp-config.php.
    define( 'AUTOSAVE_INTERVAL',    3600 );     // autosave 1x per hour
    define( 'WP_POST_REVISIONS',    false );    // no revisions
    define( 'DISABLE_WP_CRON',      true );
    define( 'EMPTY_TRASH_DAYS',     7 );        // one week
    
    Now WordPress will not automatically run the wp-cron.php script each time your site gets a new visitor.
  • 2.9 Years

    • Category : Php
    • Location : Chandigarh
    • Posted On : Dec 15, 2015
    <label for="fileToUpload"><img src="images/fileupload.png" id="blah1" width="50" height="50"/></label><input type="file" name="exmaple" id="fileToUpload" onchange="$('#blah1')[0].src = window.URL.createObjectURL(this.files[0])"  required>
    <style>
    .image-upload > input[type=file]
    {
        display: none !important;
     z-index: 0 !important;
    }
    </style>

     

  • 5.11 Years

    • Category : Wordpress
    • Location : Mohali
    • Posted On : Mar 8, 2018

    If you need to change item product prices in Woocommerce Backend Order. Please use the following hook or code

    add_action( 'woocommerce_ajax_add_order_item_meta', 'VP_set_item_quantity', 99, 3 );
    function VP_set_item_quantity( $item_id, $item, $order ) {
        foreach ( $order->get_items() as $order_item_id => $order_item_data ) {
            if ( $order_item_id == $item_id ) {
    
    
                $order_item_data->set_subtotal('20.22');
                $order_item_data->set_total(20.22);
                $order->apply_changes();
                $order->save();
    				
    		}
        }
    }
     
  • 2.9 Years

    • Category : Php
    • Location : Chandigarh
    • Posted On : Mar 30, 2016

    You can generate refer code or random code using this code in php.its easy to implement and use.

    <?php
        $character_set_array = array();
        $character_set_array[] = array('count' => 6, 'characters' => 'abcdefghijklmnopqrstuvwxyz');
        $character_set_array[] = array('count' => 1, 'characters' => '0123456789');
        $character_set_array[] = array('count' => 1, 'characters' => '!@#$ -*&?:');
        $temp_array = array();
        foreach ($character_set_array as $character_set) {
            for ($i = 0; $i < $character_set['count']; $i   ) {
                $temp_array[] = $character_set['characters'][rand(0, strlen($character_set['characters']) - 1)];
            }
        }
        shuffle($temp_array);
        $refercode= implode('', $temp_array);
        echo $refercode;
        ?>
  • 2.9 Years

    • Category : Jquery
    • Location : Chandigarh
    • Posted On : Jun 25, 2016

    you can make td editable using this code

    Note: Add Table Class editableTable
    <script>
    $(function () {
        $(".qty").dblclick(function () {
            var OriginalContent = $(this).text();
            var Originalid = $(this).attr('id');
            $(this).addClass("cellEditing");
              $(this).html("<input type='text' class='qty' value='"   OriginalContent   "' />");
            $(this).children().first().focus();
            $(this).children().first().focusout(function (e) {
                    var newContent = $(this).val();
                    $(this).parent().text(newContent);
                    $(this).parent().removeClass("cellEditing");
            });
             
        $(this).children().first().blur(function(){
            $(this).parent().text(OriginalContent);
            $(this).parent().removeClass("cellEditing");
        });
        });
    });
     </script>
  • 5.11 Years

    • Category : Css
    • Location : Mohali
    • Posted On : May 9, 2016

    this css class add your bootstrap modal then see the magic

    rotate {
        transform:rotate(180deg);
        transition:all 0.5s;
    }
    .rotate.in {
        transform:rotate(1800deg);
        transition:all 1.5s;
    }
  • 5.11 Years

    • Category : Php
    • Location : Mohali
    • Posted On : Aug 10, 2017

    This article, aimed at plugin developers, describes how to add Ajax to a plugin or page. Before reading this article, you should be familiar with the following

    // function.php in Wordpress -------- Start Code--------
    add_action('wp_head', 'dorcode_ajaxurl');
    function dorcode_ajaxurl() {
       echo '<script type="text/javascript">
               var ajaxurl = "'.admin_url('admin-ajax.php').'";
            </script>';
    }
    
    
    add_action( 'wp_ajax_your_dorcode', 'my_dorcode' );
    add_action( 'wp_ajax_nopriv_your_dorcode', 'my_dorcode' );
    
    function my_dorcode() {
    	$data_id = intval( $_POST['data_id'] );
        echo $data_id;
        wp_die();
    }
    // function.php in Wordpress -------- End Code--------
    
    
    
    // Anywhere in Wordpress -------- Start Code--------
    
    // if you need
    var ajaxurl = "<?php echo admin_url('admin-ajax.php') ?>";
    jQuery(document).ready(function($) {
    	var data = {
    		'action': 'your_dorcode',
    		'data_id': 1525
    	};
    	jQuery.post(ajaxurl, data, function(response) {
    		alert('Got this from the server:' + response);
    	});
    
    });
    // Anywhere in Wordpress -------- End Code--------
  • 2.9 Years

    • Category : Mysql
    • Location : Chandigarh
    • Posted On : Mar 31, 2016

    This code resolve special character problem during fetch data from database.just copy and paste code where you create your connection.

    //copy in config file
    mysql_set_charset('utf8');
     
  • 2.9 Years

    • Category : Php
    • Location : Chandigarh
    • Posted On : Jan 4, 2017

    Easy Multiple Image Using Codeigniter.

    if($_FILES['filename']['name']!='')
     {
           $image=array();
           $counts = count($_FILES['filename']['name']);
           $config['upload_path'] = APPPATH.'uploads/'; //create upload folder in application
                                                        // Give permission -R 777 to upload folder 
           $config['allowed_types'] = '*';
           $files = $_FILES;
           for($i=0; $i<$counts; $i  )
            {       
               if($_FILES['filename']['name'][$i]!='')
     { 
           $_FILES['filename']['name']= time().$files['filename']['name'][$i];
           $_FILES['filename']['type']= $files['filename']['type'][$i];
           $_FILES['filename']['tmp_name']= $files['filename']['tmp_name'][$i];
           $_FILES['filename']['error']= $files['filename']['error'][$i];
           $_FILES['filename']['size']= $files['filename']['size'][$i];
           $this->load->library('upload', $config);
           $this->upload->initialize($config);
           $upload= $this->upload->do_upload('familypicture');
           if($upload){
          $uu=$this->upload->data();
                $image[] =$uu['file_name'];
       }
             }
             }
       $fileToUpload = implode('|',$image);
    }
     
  • 2.9 Years

    • Category : Jquery
    • Location : Chandigarh
    • Posted On : Apr 10, 2019

    Configuration files to upload images over ckeditor using ckfinder

    /*CkEditor config.js */

    CKEDITOR.replace( "short_desc", {

       filebrowserBrowseUrl: 'http://example.com/ckfinder/ckfinder.html',

       filebrowserImageBrowseUrl: 'http://example.com/ckfinder/ckfinder.html?Type=Images',

       filebrowserUploadUrl: 'http://example.com/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',

       filebrowserImageUploadUrl: 'http://example.com/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',

       filebrowserWindowWidth: '1000',

       filebrowserWindowHeight: '700'

    });


    /*CkFinder Config.js*/

    $config['backends'][] = array(

       'name'         => 'default',

       'adapter'      => 'local',

       'baseUrl'      => 'http://example.com/assets/ckimages/',

        'root'         =>'/var/www/html/xxxx/assets/ckimages/', // Can be used to explicitly set the CKFinder user files directory.

       'chmodFiles'   => 0777,

       'chmodFolders' => 0755,

       'filesystemEncoding' => 'UTF-8',

    );

    $config['authentication'] = function () {

       return true;

    };