Skip to content

Instantly share code, notes, and snippets.

View PrafullaKumarSahu's full-sized avatar

Prafulla Kuamr Sahu PrafullaKumarSahu

View GitHub Profile
@PrafullaKumarSahu
PrafullaKumarSahu / gist:2496b2e5b57f99a22b06
Last active August 28, 2015 08:45 — forked from MindyPostoff/gist:a10148daa110119b262f
Change "Proceed to PayPal" Text on Checkout Button in WooCommerce
/* Change the "Proceed to PayPal" button text in the WooCommerce checkout screen
add_filter( 'woocommerce_order_button_text', create_function( '', 'return "Make Payment";' ) );
OR,
* Add this to your theme's functions.php file
*/
add_filter( 'gettext', 'custom_paypal_button_text', 20, 3 );
function custom_paypal_button_text( $translated_text, $text, $domain ) {
<?php
// Nav Menu Dropdown Class
include_once( CHILD_DIR . '/lib/classes/nav-menu-dropdown.php' );
/**
* Mobile Menu
*
*/
function be_mobile_menu() {
<?php
/**
* Skip cart and redirect to direct checkout
*
* @package WooCommerce
* @version 1.0.0
* @author Alessandro Benoit
*/
// Skip the cart and redirect to check out url when clicking on Add to cart
@PrafullaKumarSahu
PrafullaKumarSahu / interviewitems.MD
Last active August 29, 2015 14:27 — forked from KWMalik/interviewitems.MD
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google? -- Because I want to create tools for others to learn, for free. I didn't have a lot of money when growing up so I didn't get access to the same books, computers and resources that others had which caused money, I want to help ensure that others can learn on the same playing field regardless of their families wealth status or location.
  • What do you know about Google’s product and technology? -- A lot actually, I am a beta tester for numerous products, I use most of the Google tools such as: Search, Gmaill, Drive, Reader, Calendar, G+, YouTube, Web Master Tools, Keyword tools, Analytics etc.
  • If you are Product Manager for Google’s Adwords, how do you plan to market this?
  • What would you say during an AdWords or AdSense product seminar?
  • Who are Google’s competitors, and how does Google compete with them? -- Google competes on numerous fields: --- Search: Baidu, Bing, Duck Duck Go
@PrafullaKumarSahu
PrafullaKumarSahu / gist:c8dd96fdebb2bb7a181a
Last active September 2, 2015 15:17 — forked from ultimatemember/gist:48bf0a269af5d182ad9b
UM/EDD Open Metrics: Show various sale stats
// Avg downloads per customer
function sc_edd_avg_downloads_per_customer( $atts ) {
$amount = 0;
$query = new WP_Query( array( 'post_type' => 'download' ) );
foreach( $query->posts as $post ) {
$amount = $amount + edd_get_download_sales_stats( $post->ID );
}
$amount = $amount / edd_count_total_customers();
return number_format( $amount, 2 );
}
@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;
}
@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' );
<?php
function widgetsite_template_manage($wp_customize){
$wp_customize->add_section('theme_template_manage', array(
'title' => __('Layouts', 'widgetsite'),
'description' => '',
'priority' => 120,
));
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 ) );
}
}
@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";