Skip to content

Instantly share code, notes, and snippets.

View actual-saurabh's full-sized avatar
💭
I may be slow to respond.

Saurabh Shukla actual-saurabh

💭
I may be slow to respond.
View GitHub Profile
@actual-saurabh
actual-saurabh / PayPal Express Button on Checkout
Last active August 29, 2015 14:17
Add PayPal Express Checkout button before Woocommerce Checkout form
function paypal_express_button(){
if( function_exists( 'wc_paypal_express' ) ){
wc_paypal_express()->render_express_checkout_button();
}
}
add_action( 'woocommerce_before_checkout_form', 'paypal_express_button' );
@actual-saurabh
actual-saurabh / webhook-regular.php
Last active April 15, 2017 11:38
Regular deployment webhook script for deployment tutorial here: https://baapwp.me/2017/04/15/creating-simple-deployment-script-php/
<?php
$repositories = array(
'custom-theme' => array(
'git_url' => 'git@github.com/yapapaya/custom-theme.git',
'branch' => 'master',
'path' => '/var/www/dev.yoursite.com/htdocs/wp-content/themes/',
),
'custom-plugin' => array(
'git_url' => 'git@github.com/yapapaya/custom-plugin.git',
@actual-saurabh
actual-saurabh / webhook-slim.php
Last active April 15, 2017 11:38
Slim deployment with git archive for deployment tutorial here: https://baapwp.me/2017/04/15/creating-simple-deployment-script-php/
<?php
$repositories = array(
'custom-theme' => array(
'git_url' => 'git@github.com/yapapaya/custom-theme.git',
'branch' => 'master',
'path' => '/var/www/dev.yoursite.com/htdocs/wp-content/themes/',
),
'custom-plugin' => array(
'git_url' => 'git@github.com/yapapaya/custom-plugin.git',
@actual-saurabh
actual-saurabh / webhook-slim-github.php
Last active April 15, 2017 11:38
Slim deployment with svn fallback for GitHub for deployment tutorial here: https://baapwp.me/2017/04/15/creating-simple-deployment-script-php/
<?php
$repositories = array(
'custom-theme' => array(
'git_url' => 'git@github.com/yapapaya/custom-theme.git',
'branch' => 'master',
'path' => '/var/www/dev.yoursite.com/htdocs/wp-content/themes/',
),
'custom-plugin' => array(
'git_url' => 'git@github.com/yapapaya/custom-plugin.git',
@actual-saurabh
actual-saurabh / class-permaposttype.php
Created April 18, 2017 03:36
Rewrite Post Type URLs in WordPress
<?php
if ( ! defined( ABSPATH ) ) exit;
if ( ! class_exists( 'PermaPostType' ) ) {
class PermaPostType {
/**
* Initialise
*/
@actual-saurabh
actual-saurabh / custom-default-difficulties.php
Created March 16, 2018 08:42
Filtering LifterLMS's default difficulty levels
<?php // Do not copy this line into functions.php
// copy from under this line
function _my_llms_custom_default_difficulties() {
return array(
'Gold',
'Silver',
'Bronze',
'Any other name',
@actual-saurabh
actual-saurabh / llms-course-complete-review-link.php
Created March 23, 2018 13:13
LifterLMS replace Course Complete with custom link
@actual-saurabh
actual-saurabh / llms-peters-login-redirect.php
Last active April 20, 2018 18:21
Redirect LifterLMS users to different hub pages based on their membership
<?php // Do not copy this line
// Copy from under this line and paste into your child theme's functions.php
add_filter( 'rul_before_user', 'llms_redirect_for_login', 10, 4 );
function llms_redirect_for_login( $custom_redirect_to, $redirect_to, $requested_redirect_to, $user ){
// get the student details for the user
$student = llms_get_student( $user );
@actual-saurabh
actual-saurabh / lifterlms-custom-profile-fields.php
Created May 4, 2018 13:18 — forked from tpkemme/lifterlms-custom-profile-fields.php
Custom Fields added to LifterLMS Registration/Checkout
<?php // don't copy this line to your functions.php file
/**
*
* Create Company Industry as a custom field upon registration or checkout
*
* @param $fields - fields already being registered
* @param $screen - either checkout or registration screen
* @return $fields - array with added field
*/
function add_company_industry_lifterlms ( $fields , $screen ) {
@actual-saurabh
actual-saurabh / llms-certificate-title-merge-code.php
Last active May 25, 2018 13:51
Custom Merge Code for Certificate Title LifterLMS
<?php // Do not copy this line
// Copy from under this line and paste into your child theme's functions.php
add_filter( 'llms_certificate_merge_codes', 'llms_custom_certificate_title_merge_code', 10, 2 );
function llms_custom_certificate_title_merge_code( $merge_codes_array, $certificate_object ){
// add custom certificate title merge code to existing ones
$merge_codes_array['{certificate_title}'] = $certificate_object->title;