Skip to content

Instantly share code, notes, and snippets.

View pippinsplugins's full-sized avatar

Pippin Williamson pippinsplugins

View GitHub Profile
function pw_change_archive_order( $query ) {
if( $query->is_main_query() && is_archive() ) {
$query->set('order', 'ASC');
}
}
add_action('pre_get_posts', 'pw_change_archive_order');
$formerprojectnumber = get_post_meta($post->ID, 'ecpt_formerprojectnumber', true);
if ( empty( $formerprojectnumber ) || !is_array( $formerprojectnumber ) || $formerprojectnumber == '' ) {
echo 'None Entered';
} else {
echo $formerprojectnumber;
}
<?php
function rcp_process_paypal($subscription_data) {
global $rcp_options;
$paypal_redirect = '';
$paypal_email = $rcp_options['paypal_email'];
$listener_url = home_url('/') . '?listener=IPN';
IF ( QUERY VAR EXISTS ) {
// do not deny all
} else {
DENY ALL
}
/**
* Install
*
* Runs on plugin install.
*
* @access private
* @since 1.0
* @return void
*/
<?php
function pw_digitalstore_front_latest_downloads() {
$number = 10; // set this to the number of items you want to show
digitalstore_latest_downloads( array( 'limit' => $number ) );
}
remove_action( 'digitalstore_store_front', 'digitalstore_front_latest_downloads', 2 );
add_action( 'digitalstore_store_front', 'pw_digitalstore_front_latest_downloads', 2 );
function pw_edd_reverse_gateways( $gateways ) {
return array_reverse( $gateways );
}
add_filter('edd_payment_gateways', 'pw_edd_reverse_gateways');
// will show a list of a user's bookmarks
function upb_list_bookmarks( $delete_link = true, $delete_text = 'Delete' ) {
if(is_user_logged_in()) {
$display = '<ul class="upb-bookmarks-list">';
$bookmarks = upb_get_user_meta(upb_get_user_id());
if($bookmarks) {
foreach( $bookmarks as $bookmark) {
<?php
// Save extra taxonomy fields callback function.
function save_taxonomy_custom_meta( $term_id ) {
if ( isset( $_POST['term_meta'] ) ) {
$t_id = $term_id;
$cat_keys = array_keys( $_POST['term_meta'] );
$new_meta = array();
foreach ( $cat_keys as $key ) {
if ( isset ( $_POST['term_meta'][$key] ) ) {
$new_meta[$key] = $_POST['term_meta'][$key];
@pippinsplugins
pippinsplugins / gist:3489713
Created August 27, 2012 15:50 — forked from rezzz-dev/gist:3489697
Add a checkbox to Taxonomy
// Edit term page
function summit_taxonomy_edit_meta_field($term) {
// put the term ID into a variable
$t_id = $term->term_id;
// retrieve the existing value(s) for this meta field. This returns an array
$term_meta = get_option( "taxonomy_$t_id" ); ?>
<tr class="form-field">
<th scope="row" valign="top"><label for="term_meta[displayed]"><?php _e( 'Display Category', 'summit' ); ?></label></th>