Skip to content

Instantly share code, notes, and snippets.

View PrafullaKumarSahu's full-sized avatar

Prafulla Kuamr Sahu PrafullaKumarSahu

View GitHub Profile
<?php
/**
* Plugin Name:
* Plugin Author:
* Plugin URI:
*/
require_once realpath(dirname(__FILE__) . '/google-api-php-client/src/Google/autoload.php');
session_start();
global $analytica_db_version;
<?php
/**
* Plugin Name:
* Plugin Author:
* Plugin URI:
*/
require_once realpath(dirname(__FILE__) . '/google-api-php-client/src/Google/autoload.php');
session_start();
global $analytica_db_version;
<?php
/**
* Plugin Name:
* Plugin Author:
* Plugin URI:
*/
require_once realpath(dirname(__FILE__).'/google-api-php-client/src/Google/autoload.php');
session_start();
<?php
/** Bootstrap WordPress */
include('./wp-load.php');
/**
* Generate some random data
*/
$data = array();
$iterations = 10;
@PrafullaKumarSahu
PrafullaKumarSahu / Database Connection using PDO and some basic functions
Created October 15, 2015 10:01
Learning PDO in as possible correct way .
<?php
class Database
{
private $conn;
private $handle;
public function __construct()
{
$dbhost = "localhost";
$dbname = "pdo_test";
Introducing pre_get_posts :-
------------------------------
class WP_Query{
function &get_posts(){
$this->parse_query();
//pre_get_posts()
do_action_ref_array( 'pre_get_posts', array( &$this ) );
}
}
<?php
function widgetsite_template_manage($wp_customize){
$wp_customize->add_section('theme_template_manage', array(
'title' => __('Layouts', 'widgetsite'),
'description' => '',
'priority' => 120,
));
@PrafullaKumarSahu
PrafullaKumarSahu / gist:2964107b65ec8b8cadf7
Last active September 4, 2015 05:57 — forked from mikejolley/gist:f072ed42f3ec33385e38
Using reCAPTCHA with WP Job Manager
<?php
// Define your keys here
define( 'RECAPTCHA_SITE_KEY', 'XXX' );
define( 'RECAPTCHA_SECRET_KEY', 'XXX' );
// Enqueue Google reCAPTCHA scripts
add_action( 'wp_enqueue_scripts', 'recaptcha_scripts' );
function recaptcha_scripts() {
wp_enqueue_script( 'recaptcha', 'https://www.google.com/recaptcha/api.js' );
@PrafullaKumarSahu
PrafullaKumarSahu / gist:c16fceecf4e117e6e1cb
Last active September 3, 2015 06:18 — forked from ultimatemember/gist:f7eab149cb33df735b08
Extend Ultimate Member Account page with custom tabs/content
/* add new tab called "mytab" */
add_filter('um_account_page_default_tabs_hook', 'my_custom_tab_in_um', 100 );
function my_custom_tab_in_um( $tabs ) {
$tabs[800]['mytab']['icon'] = 'um-faicon-pencil';
$tabs[800]['mytab']['title'] = 'My Custom Tab';
$tabs[800]['mytab']['custom'] = true;
return $tabs;
}