First create global variables (in functions.php or as a mu-plugin):
<?php
/*
* CUSTOM GLOBAL VARIABLES
*/
function wtnerd_global_vars() {
<?php | |
add_action( 'template_redirect', 'woo_custom_redirect_after_purchase' ); | |
function woo_custom_redirect_after_purchase() { | |
global $wp; | |
if ( is_checkout() && !empty( $wp->query_vars['order-received'] ) ) { | |
wp_redirect( 'http://localhost:8888/woocommerce/custom-thank-you/' ); | |
exit; | |
} | |
} |
<?php | |
//Declare the Connection Credentials | |
$servername = 'localhost'; //or IP address for DB hosted elsewhere | |
$username = 'root'; | |
$password = ""; | |
$database = "ussd"; | |
$dbport = 3306; | |
// Create connection | |
$db = new mysqli($servername, $username, $password, $database, $dbport); | |
// Check connection, if there is an error end the USSD connection |
<?php | |
/* Simple sample USSD registration application | |
* USSD gateway that is being used is Africa's Talking USSD gateway | |
*/ | |
// Print the response as plain text so that the gateway can read it | |
header('Content-type: text/plain'); | |
/* local db configuration */ | |
$dsn = 'mysql:dbname=dbname;host=127.0.0.1;'; //database name |
function mysite_pending($order_id) { | |
error_log("$order_id set to PENDING", 0); | |
} | |
function mysite_failed($order_id) { | |
error_log("$order_id set to FAILED", 0); | |
} | |
function mysite_hold($order_id) { | |
error_log("$order_id set to ON HOLD", 0); | |
} | |
function mysite_processing($order_id) { |
<?php | |
/* | |
Plugin Name: Toggle Debug | |
Description: Proof-of-concept for an admin-bar debug mode toggle. Needs some UX love. | |
*/ | |
/* | |
// In wp-config.php, wrap debug constants in a cookie conditional | |
if ( isset( $_COOKIE['wp-debug'] ) && $_COOKIE['wp-debug'] == 'on' ) { | |
define('WP_DEBUG', true); | |
} |
<?php | |
/* | |
Plugin Name: Arunas Hides Plugins | |
Plugin URI: http://arunas.co/hidesplugins | |
Description: A simple proof-of-concept plugin to hide specific plugins from Plugins' list in WP Admin if it is a Multisite install and the user is not the Super Administrator. | |
Author: Arūnas Liuiza | |
Version: 0.2 | |
Author URI: http://arunas.co/ | |
*/ |
function filter_admin_menues() { | |
// If administrator then do nothing | |
if (current_user_can('activate_plugins')) return; | |
// Remove main menus | |
$main_menus_to_stay = array( | |
// Dashboard | |
'index.php', |
curl -O https://wordpress.org/latest.zip | |
unzip latest.zip | |
mv wordpress site | |
rm latest.zip |
/////////////////////////////////////////////////////////////////////////////////// | |
/// Colection of RGB to HSB, HSB to RGB convert functions | |
/// Source: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb | |
/////////////////////////////////////////////////////////////////////////////////// | |
/** | |
* componentToHex convert two digit htx value to R, G or B chanel value | |
* @param number c value from 0 to 225 | |
* @return string value of R, G or B chanel | |
* @usage //alert (componentToHex(255)); //ff |
First create global variables (in functions.php or as a mu-plugin):
<?php
/*
* CUSTOM GLOBAL VARIABLES
*/
function wtnerd_global_vars() {