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 pw_rcp_earnings_slash_command() { | |
# Check to make sure this is a Slash Command Request | |
if ( ! isset( $_REQUEST['slack_slash'] ) && 'your_custom_string' != $_REQUEST['slack_slash'] ) | |
return false; | |
# Check to see if a token has been passed as well | |
if ( ! isset( $_REQUEST['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
function custom_prefix_warn_about_old_refunds_js() { | |
if ( ! isset( $_GET['prevent_accidental_refunds_js'] ) ) { | |
return false; | |
} | |
header('Content-Type: application/javascript'); | |
?> |
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
<a href="<?php echo add_query_arg( array( 'edd_action' => 'add_to_cart', 'download_id' => get_the_ID() ), edd_get_checkout_uri() ); ?>">Add to Cart</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
// Function to display only upcoming events for Sugar Events Calendar on the main Events archive. | |
function sc_filter_events( $query ) { | |
if( is_post_type_archive('sc_event') && (!is_admin()) ) { | |
$meta = array( | |
array( | |
'key' => 'sc_event_date_time', | |
'value' => time(), |
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_filter( 'mailchimp_sync_subscriber_data', function( MC4WP_MailChimp_Subscriber $subscriber, $user ) { | |
$affiliate = affiliate_wp()->affiliates->get_by( 'user_id', $user->ID ); | |
if( ! empty( $affiliate ) ) { | |
$subscriber->merge_fields['MERGE6'] = $affiliate->affiliate_id; | |
} | |
return $subscriber; | |
}, 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
private $defaultCapabilities = array( | |
'connections_view_dashboard' => __('View Dashboard', 'your-domain'), | |
'connections_manage' => __('View List (Manage)', 'your-domain'), | |
'connections_add_entry' => __('Add Entry', 'your-domain'), | |
'connections_add_entry_moderated' => __('Add Entry Moderated', 'your-domain'), | |
'connections_edit_entry' => __('Edit Entry', 'your-domain'), | |
'connections_edit_entry_moderated' => __('Edit Entry Moderated', 'your-domain'), | |
'connections_delete_entry' => __('Delete Entry', 'your-domain'), | |
'connections_view_public' => __('View Public Entries', 'your-domain'), | |
'connections_view_private' => __('View Private Entries', 'your-domain'), |
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 change_author_capabilities() { | |
$role = get_role( 'shop_vendor' ) ; | |
$role->add_cap( 'delete_products' ); | |
} | |
add_action( 'admin_init', 'change_author_capabilities' ); |
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 | |
/* | |
Usage: | |
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL | |
if ( !$frag->output() ) { // NOTE, testing for a return of false | |
functions_that_do_stuff_live(); | |
these_should_echo(); | |
// IMPORTANT | |
$frag->store(); | |
// YOU CANNOT FORGET THIS. If you do, the site will break. |
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 | |
/** | |
* Retrieve the purchase ID based on the purchase key | |
* | |
* @access public | |
* @since 1.2.3 | |
* | |
* @param string $key the purchase key to search for | |
* @return int $order_id | |
*/ |
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 jc_paged_posts_columns() { | |
echo '<div id="paged-columns">'; | |
global $post; | |
$numposts = 11; | |
$args = array( 'numberposts' => $numposts, 'offset' => 10 ); | |
$column1 = get_posts( $args ); | |
echo '<ul class="column-list">'; | |
echo '<li class="column-heading">Page 2</li><ol>'; | |
foreach ( $column1 as $post ) : setup_postdata($post); ?> | |
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> |
NewerOlder