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
<?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
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
$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
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
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
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
<?php | |
/** | |
* Plugin Name: PluginName | |
* Plugin URI: http://austinpassy.com/wordpress-plugins/ | |
* Description: Core functionality for __________ | |
* Version: 1.0.0 | |
* Author: Austin Passy | |
* Author URI: http://austinpassy.com/ | |
* | |
* @copyright 2012 |
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
$sql = "CREATE TABLE {$wpdb->prefix}venuesmeta ( | |
meta_id bigint(20) unsigned NOT NULL auto_increment, | |
venues_id bigint(20) unsigned NOT NULL default '0', | |
meta_key varchar(255) default NULL, | |
meta_value longtext, | |
PRIMARY KEY (meta_id), | |
KEY venues_id (venues_id), | |
KEY meta_key (meta_key) | |
) {$charset_collate};"; |
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 add_twitter_discount() { | |
global $post; | |
$post_id = $_POST['id']; | |
$item = get_post_meta( $post_id, 'item_number_discount', true ); | |
$numb = str_replace( 'theme-', '', $item ); | |
//if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'confirmed' ) { | |
$arr = array(); |