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 ff_aweber_mass_update_fields( | |
$file = '', | |
$list_id = 2534516, // thedigitalinsurer | |
$consumerKey = 'AkFCmZ046GCL17wKVR0L2xsV', | |
$consumerSecret = 'Sa5Ugpm40NHMcIWKC6TGeDEl204JThMy0nBHFXc4', | |
$accessKey = 'AgzYa7KUgu0UBivqDk22tJdS', | |
$accessSecret = 'XmLHVT4mW1oKI5VwWIEBSGhWvfavaxja2zQZn8TN' | |
) | |
{ |
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
$start = new DateTime('2013-08-01'); | |
$start->modify('first day of this month'); | |
$end = new DateTime(date('Y-m-d')); // current date | |
$end->modify('first day of next month'); | |
$interval = DateInterval::createFromDateString('1 month'); | |
$period = new DatePeriod($start, $interval, $end); | |
foreach ($period as $dt) { | |
echo $dt->format("F Y"); | |
} |
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
<html> | |
<head> | |
<style> | |
.ff-load-more > .item { | |
display: none; | |
} | |
.ff-load-more > .item.active { | |
display: block; | |
} |
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 | |
$url = 'https://fivebyfive.com.au/wp-json/wp/v2/posts'; | |
// Using file_get_contents | |
// Some hostings might disable this for security purposes | |
$result = file_get_contents($url); | |
$result = json_decode($result); | |
foreach( $result as $post ) { | |
echo '<pre>'. print_r($post->title->rendered, true) . '</pre>'; | |
} | |
// Using url |
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 | |
// Send data to hubspot | |
$hubspot_portal_id = '4421750'; | |
$hubspot_form_guid = '35d60c88-89f4-46a6-b2e8-996f60cd5445'; | |
$url = 'https://forms.hubspot.com/uploads/form/v2/'. $hubspot_portal_id .'/'. $hubspot_form_guid; | |
$data = array(); | |
if( isset($_POST['ff_quiz_first_name']) ) $data['firstname'] = $_POST['ff_quiz_first_name']; | |
if( isset($_POST['ff_quiz_last_name']) ) $data['lastname'] = $_POST['ff_quiz_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
// Free retail shipping | |
add_filter('woocommerce_package_rates','ff_override_flat_rate_price',100,2); | |
function ff_override_flat_rate_price($rates,$package) { | |
// Modify shipping cost for Books depending on quantity | |
if( ff_get_cart_total_quantity() >= 2 && ff_get_cart_total_quantity() <= 3 ) { | |
// 2 or 3 = 15.95 | |
foreach ($rates as $rate) { | |
//Set the price | |
$rate->cost = 15.95; | |
//Set the TAX |
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
// Pagination fix | |
if( $('.wp-pagenavi').length ) { | |
var url, match, find_page_var, page_var, split_page_var, new_page_parameter, new_url; | |
$('.wp-pagenavi a').each(function(){ | |
url = $(this).attr('href'); | |
// get the page parameter from the url | |
match = /\/page\/[0-9]+\//g.exec(url); | |
if( match ) { | |
page_var = match[0]; | |
split_page_var = page_var.split('/'); |
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 | |
$feed_url = 'https://batchaws.adcourier.com/panel/?q=U2FsdGVkX19JpL80ZgsoSN4F3N3Ut1LGKwgX7VVH7q4RgdsLDocx-3L9VEoNT8WW'; | |
$ch = curl_init(); | |
curl_setopt ($ch, CURLOPT_URL, $feed_url); | |
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_HEADER, false); | |
$xml = curl_exec($ch); | |
$jobs_feed = simplexml_load_string($xml); |
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 ff_get_image_id_by_url($image_url, $type = 'full') { | |
global $wpdb; | |
if( $type === 'full' ) { | |
// Search url | |
$attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url )); | |
} else { | |
// Search name using LIKE | |
$attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid LIKE '%s';", '%' . $wpdb->esc_like($image_url) . '%' )); | |
} | |
if( $attachment ) |
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
// Set post term to post id, create term if it does not exist | |
function ff_set_post_term_with_fallback($post_id, $value, $taxonomy, $create_new = true ){ | |
if( $value == '' ) return; | |
// Search term | |
$term = term_exists( $value, $taxonomy); | |
if( $term ) { | |
// Term exists | |
wp_set_post_terms( $post_id, $term['term_id'], $taxonomy, true ); | |
} else { | |
// Term does not exist, create new |
OlderNewer