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 | |
//add action to process mailchimp signup if checked | |
function mc_checkout_field_process() { | |
//only run the following if the option to subscribe has been selected | |
if ( $_POST['mc-subscribe'] == 'on' ) { | |
//retrieve email, first, and last name from form | |
$email = $_POST['billing_email']; | |
$first_name = $_POST['billing_first_name']; | |
$last_name = $_POST['billing_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 | |
//add the count to our shop menu items | |
function nim_menu_item_count( $items, $menu, $args ) { | |
// Only proceed if we are looking at the correct menu and not in the admin | |
if ( $menu->slug != 'your-menu-slug' || is_admin() ) | |
return $items; | |
//grab each menu item and it's object_id (which ends up being the category ID for the product category) | |
foreach ($items as $item) { |
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 | |
//add tooltip to cvc field | |
function custom_credit_card_fields_cis_cc ($cc_fields , $payment_id){ | |
$cc_fields['card-cvc-field'] = str_replace('<p class="form-row form-row-last">','<p class="form-row form-row-last" title="3-digit security code usually found on the back of your card. American Express cards have a 4-digit code located on the front.">',$cc_fields['card-cvc-field']); | |
return $cc_fields; | |
} | |
add_filter( 'woocommerce_credit_card_form_fields' , 'custom_credit_card_fields_cis_cc' , 10, 2 ); |
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 | |
//make sure your page access token has the 'publish_actions' scope | |
$access_token = 'YOURACCESSTOKEN'; | |
$pageid = 'YOURPAGEID'; | |
//fb graph api only allows this to be up to 100 | |
$limit = '100'; | |
//retireve posts on specific page ID: | |
$fb_ret_url = 'https://graph.facebook.com/' . $pageid . '/posts?limit=' . $limit . '&access_token=' . $access_token; |
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 | |
function clear_jetpack_published() { | |
if(empty($_REQUEST['post'])) { | |
wp_die(__('Invalid post ID or action')); | |
} | |
global $wpdb; | |
$id = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : ''; |
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
import time | |
import datetime | |
editor.beginUndoAction() | |
def calculate(match): | |
epoch = datetime.datetime(1970, 1, 1) | |
s = "%s/%s/%s" % (match.group(1), match.group(2), match.group(3)) | |
t = datetime.datetime.strptime(s, "%Y/%m/%d") | |
diff = t-epoch |
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 | |
function mail_from() { | |
$emailaddress = '[email protected]'; | |
return $emailaddress; | |
} | |
function mail_from_name() { | |
$sendername = "1stWebDesigner.com - Dainis"; | |
return $sendername; | |
} |
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
/** | |
* Gravity Wiz // Gravity Forms // Populate Field from One Page to Field in Subsequent Page | |
* http://gravitywiz.com/ | |
*/ | |
// update "1074" to the ID of your form | |
add_filter( 'gform_pre_render_1074', function( $form ) { | |
foreach( $form['fields'] as &$field ) { | |
// update "2" to the field ID on the later page |
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 | |
$items = array( | |
1 => array( 'item' => explode( '|', rgar( $entry, '20' ) ), 'title' => rgar( $entry, '5' ), 'name' => rgar( $entry, '7' ), 'company' => rgar( $entry, '8' ), 'position' => rgar( $entry, '9' ), 'address_1' => rgar( $entry, '10.1' ), 'address_2' => rgar( $entry, '10.2' ), 'city' => rgar( $entry, '10.3' ), 'state' => rgar( $entry, '10.4' ), 'zip' => rgar( $entry, '10.5' ), 'country' => rgar( $entry, '10.6' ), 'phone' => rgar( $entry, '33' ), 'fax' => rgar( $entry, '11' ), 'old_pos' => rgar( $entry, '13' ), 'emp_dates' => rgar( $entry, '14' ), 'contact_rel' => rgar( $entry, '15' ), 'new_pos' => rgar( $entry, '18' ), 'reason_left' => rgar( $entry, '16' ), 'last_sal' => rgar( $entry, '17' ), 'add_notes' => rgar( $entry, '21' ), 'rush' => explode( '|', rgar( $entry, '22.1' ) ), 'international' => explode( '|', rgar( $entry, '23.1' ) ) ), | |
2 => array( 'item' => explode( '|', rgar( $entry, '46' ) ), 'title' => rgar( $entry, '49' ), 'name' => rgar( $entry, '51' ), 'company' => rgar( $entry, '52' |
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
function have_https_for_media( $url ) { | |
if ( is_ssl() ) | |
$url = str_replace( 'http://', 'https://', $url ); | |
return $url; | |
} | |
add_filter( 'wp_get_attachment_url', 'have_https_for_media' ); |
OlderNewer