Skip to content

Instantly share code, notes, and snippets.

@mintplugins
mintplugins / gist:34976827e7e435f0c49d
Last active August 29, 2015 14:22
PostGrid: How to use featured image instead of permalink on postgrid page
/**
* Filter the permalink for a postgrid posts if it is a custom post type
*
* @since 1.5.0
*
* @param string $permalink The permalink for the post in question
* @param int $grid_post_id The post ID in question.
* @param int $brick_id The Brick ID containing the post grid
*/
function my_custom_permalinks_for_postgrid( $permalink, $grid_post_id, $brick_id ){
@mintplugins
mintplugins / gist:5caf807b094bddfb6181
Created May 31, 2015 03:50
PostGrid: Filter the classes for a postgrid links to make them open in a lightbox
/**
* Filter the classes for a postgrid links to make them open in a lightbox
*
* @since 1.5.0
*
* @param string $classes The string containing all of the classes for postgrid links
*/
function my_custom_postgrid_classes( $classes ){
return 'mp-stacks-lightbox-link';
}
@mintplugins
mintplugins / gist:aeac07660a5d0ab5117e
Created June 3, 2015 16:38
MP Stacks + DownloadGrid: How to add the Author to the Title for Grid Items
function my_downloadgrid_add_author_to_title( $post_title, $post_id ){
//Get the author of the post in question
$post_object = get_post( $post_id );
$author_id = $post_object->post_author;
$author_nicename = get_the_author_meta( 'user_nicename', $author_id );
return $post_title . ' | ' . $author_nicename;
}
@mintplugins
mintplugins / gist:f6d7be7fb6d7ee6d98b2
Last active November 10, 2015 03:15
Migrate Sermons
<?php
//Paste this function into your theme's functions.php file to create a duplicate ctc_sermon for each mp_sermon
//Set the args for the new query
$mp_sermon = array(
'post_type' => "mp_sermon",
'posts_per_page' => -1,
'order' => 'ASC',
);
@mintplugins
mintplugins / MP Stacks Isotopes Trigger Filter on Load
Created November 18, 2015 17:30
With MP Stacks Isotopes, trigger a a filter button being clicked once the page has loaded.
$( '.mp-stacks-grid-isotope' ).imagesLoaded( function( instance ){
$( '[data-filter="[mp_stacks_grid_isotope_taxonomy_category*=\'YOUR_FILTER_SLUG_HERE,\']"' ).trigger( 'click' );
});
<?php
//Paste this function into your theme's functions.php file to create a duplicate ctc_sermon for each old sermon
function mp_migrate_ezekiel_sermons(){
if ( !isset( $_GET['duplicate_sermons'] ) ){
return;
}
//Set the args for the new query
$cpt_sermons = array(
/**
* Convert buy buttons to straight-up download buttons if the download is free
*
* @since 1.0.0
* @link http://mintplugins.com/doc/
* @see function_name()
* @param array $args See link for description.
* @return void
*/
function mp_edd_free_edd_purchase_download_form( $purchase_form, $args ){
@mintplugins
mintplugins / mp-stacks-postgrid-custom-taxonomies.php
Last active February 27, 2016 20:32
Using Custom Taxonomies for Isotope Controls in MP Stacks + PostGrid:
function my_custom_postgrid_isotope_taxonomies( $isotope_filter_groups ){
//This array can contain custom groups (for outside sources like instgram), AND/OR WordPress taxonomy slugs.
$isotope_filter_groups = array(
'taxonomy1_slug' => array(
'is_wordpress_taxonomy' => true,
'filter_group_name' => __( 'Name of Taxonomy1', 'mp_stacks_postgrid' ),
'meta_field_ids_representing_tax_term' => array(), //Leave this blank if it is a WordPress taxonomy (as opposed to a "fake" one like "twitter-user")
//Icon info
'default_icon_font_string' => 'fa-th-large', //A default icon-font class string to use if no unique icon is given
@mintplugins
mintplugins / mp-stacks-custom=password-snippet.php
Created March 8, 2016 03:53
MP Stacks - Custom Password Message
function my_custom_mp_stacks_password_message(){
return 'Your Custom Message Here';
}
add_filter( 'mp_stacks_password_message', 'my_custom_mp_stacks_password_message' );
function pw_send_subscription_cancelled_to_admin( $sub_id, $subscription ) {
$email_to = 'your@email.com';
$subject = 'Subscription Cancelled';
$message = 'Subscription cancelled for ' . $subscription->customer->email;
EDD()->emails->send( $email_to, $subject, $message );
}
add_action( 'edd_subscription_cancelled', 'pw_send_subscription_cancelled_to_admin', 10, 2 );
function pw_send_subscription_failed_to_admin( $subscription ) {
$email_to = 'your@email.com';