Tuesday, 25 July 2017

remove update from wordpress

/*&
     *@Disable auto update plugn and themes and wordpress version
     */
   
    add_action('after_setup_theme','remove_core_updates');
    function remove_core_updates()
    {
    if(! current_user_can('update_core')){return;}
    add_action('init', create_function('$a',"remove_action( 'init', 'wp_version_check' );"),2);
    add_filter('pre_option_update_core','__return_null');
    add_filter('pre_site_transient_update_core','__return_null');
    }

    remove_action('load-update-core.php','wp_update_plugins');
    add_filter('pre_site_transient_update_plugins','__return_null');

change column position in wordpress








 add code on function.php

 //change manage_finance_posts_columns finance to your custom posttype

function array_insert( $array, $index, $insert ) {
    return array_slice( $array, 0, $index, true ) + $insert +
    array_slice( $array, $index, count( $array ) - $index, true);
}
add_filter('manage_finance_posts_columns', 'hs_finance_table_head');
function hs_finance_table_head( $columns ) {   

    return array_insert( $columns, 2,['country'=>'Country']);  

}

add_action( 'manage_finance_posts_custom_column', 'hs_finance_table_content');

function hs_finance_table_content( $column_name, $post_id ) {
   
    if( $column_name == 'country' ) {
       
                echo get_post_field('country', $post_id);       
    }

Monday, 3 July 2017

get all querystring from javascript

/*
    * get all querystring
    */
   function getParameterByName(name, url) {
    if (!url) url = window.location.href;
    name = name.replace(/[\[\]]/g, "\\$&");
    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, " "));
}

    var getCountryData = getParameterByName('country'); // "lorem"

Tuesday, 23 May 2017

Create multi language file in wordpress

#######define Constant in wp-config.php file ######
define ('WPLANG', 'en_US');

#####add code in function.php######
function my_child_theme_locale() {
   load_child_theme_textdomain( 'framework', get_stylesheet_directory() . '/languages' );
}

add_action( 'after_setup_theme', 'my_child_theme_locale' );

####create mo file in wordpress commond###########
msgcat default.po | msgfmt -o languages/en_US.mo -

Monday, 17 April 2017

add ip for phpmyadmin


/etc/phpmyadmin$ sudo vim config.inc.php
/* Advance to next server for rest of config */
    $i++;
    $cfg['Servers'][$i]['verbose'] = 'Anil DB Magic2';
    $cfg['Servers'][$i]['host'] = 'XXX.XXX.X.XXX';
    $cfg['Servers'][$i]['port'] = '';
    $cfg['Servers'][$i]['socket'] = '';
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    $cfg['Servers'][$i]['AllowNoPassword'] = false;

Monday, 27 March 2017

ckeditor for multiple id

var editor_config = {
    toolbar: [
        {name: 'basicstyles', items: ['Bold', 'Italic']},
        {name: 'paragraph', items: ['BulletedList']}
    ],
    width: "210px",
    height: "140px"
};

CKEDITOR.replace('dsi3', editor_config );
CKEDITOR.replace('dsi4', editor_config );
CKEDITOR.replace('dsi5', editor_config );
CKEDITOR.replace('dsi6', editor_config );

Wednesday, 28 December 2016

footer alway on bottom


 <script>

  $(document).ready(function() {

   var docHeight = $(window).height();
   var footerHeight = $('footer').height();
   var footerTop = $('footer').position().top + footerHeight;

   if (footerTop < docHeight) {
    $('footer').css('margin-top', 10+ (docHeight - footerTop) + 'px');
   }
  });
 </script>