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
Why is this returning an empty array()? | |
$order-items->name = empty array() | |
$order->items = | |
[items] => Array | |
( | |
[0] => Array | |
( | |
[id] => 88 |
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 get_editable_roles() { | |
global $wp_roles; | |
$all_roles = $wp_roles->roles; | |
$editable_roles = apply_filters( 'editable_roles', $all_roles ); | |
$options = array(); | |
foreach ( $editable_roles as $roles ) { | |
foreach( $roles as $role ) { | |
$options[] = array( $role => $role ); |
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
global $post; | |
$args = array( | |
'post__not_in' => array( $post->ID ), | |
'posts_per_page'=> -1, | |
'day' => get_the_time( 'd', $post->ID ), | |
'month' => get_the_time( 'm', $post->ID ), | |
'year' => get_the_time( 'Y', $post->ID ), | |
); | |
$the_query = new WP_Query( $args ); |
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
$ads = array('<a href="#">Sponsored link 1</a>', '<a href="#">Sponsored link 2</a>', '<a href="#">Sponsored link 3</a>'); | |
echo $ads[array_rand($ads, 1)]; | |
OR | |
$numb = rand( 1, 3 ); | |
if ( $numb == 1 ) | |
echo '<a href="#">Sponsored link 1</a>'; |
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_shortcode( 'md5', 'md5_email_hash' ); | |
function md5_email_hash( $atts ) { | |
extract( shortcode_atts( array( | |
'hash' => '', | |
), $atts ) ); | |
$hash = ( isset( $_GET['email'] ) && !empty( $_GET['email'] ) ) ? $_GET['email'] : $hash; | |
$hash = is_email( $hash ) ? sanitize_email( strtolower( $hash ) ) : trim( $hash ); |
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 autoset_featured() { | |
global $post; | |
if ( empty( $post ) ) return; | |
$already_has_thumb = has_post_thumbnail( $post->ID ); | |
if ( !$already_has_thumb ) { | |
$attached_image = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => '1' ) ); | |
if ( $attached_image ) { |
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 | |
// http://www.avery.com/avery/en_us/Products/Name-Badges/Name-Badges/Insertable-Name-Badges_74459.htm (3" X 4") | |
// Add a page, but only on a multiple of 6 | |
if ( $counter == 1 || ( $counter % 7 == 0 ) ) { | |
$pdf->AddPage('P', 'Letter'); | |
$counter = 1; | |
} | |
// Set the co-ordinates for all items in each of the badges | |
switch ( $counter ) { |
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
$defaults = array( | |
'company' => 'client_company', | |
'address_1' => 'client_address_1', | |
'address_2' => 'client_address_2', | |
'city' => 'client_city', | |
'state' => 'client_state', | |
'postcode' => 'client_postcode', | |
'country' => 'client_country' | |
); |
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 validate_license() { | |
//print '<pre>' . print_r( $_POST, true ) . '</pre>'; | |
//print '<pre>' . print_r( $this->settings_sections, true ) . '</pre>'; | |
//exit; | |
$data = array(); | |
foreach ( $this->settings_sections as $section ) { | |
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 get_extendd_my_account_pages() { | |
$all_wp_pages = wp_cache_get( 'extendd_my_account_pages' ); | |
if ( false === $all_wp_pages ) { | |
// Set up the objects needed | |
$the_query = new WP_Query(); | |
$all_wp_pages = $the_query->query( array( 'post_type' => 'page' ) ); | |
wp_cache_set( 'extendd_my_account_pages', $all_wp_pages ); | |
} |