This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change text strings | |
* | |
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext | |
*/ | |
function my_text_strings( $translated_text, $text, $domain ) { | |
switch ( $translated_text ) { | |
case 'Sale!' : | |
$translated_text = __( 'Clearance!', 'woocommerce' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//split name into first and last | |
function split_name($name) { | |
$name = trim($name); | |
$last_name = (strpos($name, ' ') === false) ? '' : preg_replace('#.*\s([\w-]*)$#', '$1', $name); | |
$first_name = trim( preg_replace('#'.$last_name.'#', '', $name ) ); | |
return array($first_name, $last_name); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Adding First and Last Name to Checkout Form | |
*/ | |
//add the fields to the form | |
function my_pmpro_checkout_after_password() | |
{ | |
if(!empty($_REQUEST['firstname'])) | |
$firstname = $_REQUEST['firstname']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Set a maximum number of members allowed to register for a membership level. | |
Add this code to a plugin for PMPro Customizations. | |
Set the "Maximum" for a level on the Memberships > Membership Levels > Edit Level admin page. | |
*/ | |
function pmproml_pmpro_save_membership_level( $level_id) { | |
if( $level_id <= 0 ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Algorithm: | |
1) Get all the fields of current item | |
2) Store all fields in an array | |
3) create a empty string to store all the item data and call as itemdata (typeof string) | |
4) Iterate through each item and push data into itemdata | |
5) Remove all the html using regrex from itemdata if any | |
6) return itemdata | |
Basic code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Force SSL URL Scheme | |
Plugin URI: https://gist.github.com/webaware/4688802 | |
Description: Force the protocol scheme to be HTTPS when is_ssl() doesn't work | |
Version: 1.0.0 | |
Author: WebAware | |
Author URI: http://webaware.com.au/ | |
@ref: http://wordpress.org/support/topic/ssl-insecure-needs-35-compatibility |
NewerOlder