Skip to content

Instantly share code, notes, and snippets.

View pastorjacklamb's full-sized avatar

Jack Lamb pastorjacklamb

View GitHub Profile
============================================================
Add to Col 1 Content (in "Text" NOT "Visual" mode):
============================================================
<div class="voegtlin-header">
<strong>Latest Article</strong>
[display-posts category="blog" posts_per_page="1" wrapper="div"]
</div>
============================================================
Add to Col 2 Content (in "Text" NOT "Visual" mode):
@pastorjacklamb
pastorjacklamb / gist:73d81bea3f474d6c6147
Last active August 29, 2015 14:18
used to add the sermon description to the sermon excerpt view. Place in theme functions.php file
add_action( 'init' , 'custom_add_and_remove' , 15);
function custom_add_and_remove() {
remove_action( 'sermon_excerpt', 'wpfc_sermon_excerpt' );
add_action( 'sermon_excerpt', 'custom_wpfc_sermon_excerpt' );
}
function custom_wpfc_sermon_excerpt() {
global $post;?>
<div class="wpfc_sermon_wrap cf">
<div class="wpfc_sermon_image">
@pastorjacklamb
pastorjacklamb / gist:2337267050f720b53901
Created October 15, 2014 21:33
Remove Sermon Manager Podcast functions
remove_action( 'rss_ns', 'wpfc_podcast_add_namespace' );
remove_action( 'rss2_ns', 'wpfc_podcast_add_namespace' );
remove_action('rss_head', 'wpfc_podcast_add_head');
remove_action('rss2_head', 'wpfc_podcast_add_head');
remove_action('rss_item', 'wpfc_podcast_add_item');
remove_action('rss2_item', 'wpfc_podcast_add_item');
remove_filter( 'the_content_feed', 'wpfc_podcast_summary', 10, 3);
remove_filter( 'the_excerpt_rss', 'wpfc_podcast_summary');
@pastorjacklamb
pastorjacklamb / gist:7723214
Last active December 29, 2015 20:19
create your own array for CMB
<?php
// Get categories
$categories = get_categories();
// Initate an empty array
$cat_options = array();
if ( !empty( $categories ) ) {
foreach ( $categories as $key => $term ) {
$cat_options[] = array(
'name' => $term->name,
'value' => $term->slug,
@pastorjacklamb
pastorjacklamb / gist:7217277
Created October 29, 2013 15:51
This can be added to the theme functions.php file to only display sermons from a particular service type on the main sermon archive page. You just need to replace the REPLACETHISWITHYOURSERVICETYPESLUG with your service type slug. For example, to only display sermons from the "Sunday AM" service type, you would use the service type slug of 'sund…
// Make the main sermon page only show sermon from a particular service type
function redeemer_sermon_order_query( $query ) {
if ( !is_admin() && $query->is_main_query() ) :
if( is_post_type_archive('wpfc_sermon') ) {
$query->set('wpfc_service_type', 'REPLACETHISWITHYOURSERVICETYPESLUG');
}
endif;
}
add_action('pre_get_posts', 'redeemer_sermon_order_query', 999);
@pastorjacklamb
pastorjacklamb / gist:5958144
Created July 9, 2013 15:08
Show the most recent sermon
<?php
$args = array(
'post_type' => 'wpfc_sermon',
'order' => 'DESC',
'meta_key' => 'sermon_date',
'meta_value' => date("m/d/Y"),
'meta_compare' => '>=',
'orderby' => 'meta_value',
'posts_per_page' => 1
);
@pastorjacklamb
pastorjacklamb / gist:5905815
Created July 2, 2013 00:12
Shortcode to display the changelog from EDD Software Licensing [changelog id="DOWNLOAD-ID"]
function jack_edd_changelog_shortcode($atts = 0) {
extract( shortcode_atts( array(
'id' => '0',
),
$atts ) );
return get_post_meta( $id, '_edd_sl_changelog', true );
}
add_shortcode( 'changelog', 'jack_edd_changelog_shortcode' );
@pastorjacklamb
pastorjacklamb / gist:5876302
Last active December 19, 2015 01:29
Display Series Image and Description on series archive page
<div id="wpfc_sermon_tax_description" class="clearfix">
<?php
/* Image - Change 'content-width' to any registered image size */
print apply_filters( 'sermon-images-queried-term-image', '', array( 'attr' => array( 'class' => 'alignleft post-thumb' ), 'after' => '</div>', 'before' => '<div id="wpfc_sermon_image">', 'image_size' => 'content-width', ) );
/* Description */
$category_description = category_description();
if ( ! empty( $category_description ) )
echo '<div class="sermon-tax-description">' . $category_description . '</div>';
?>
</div>
@pastorjacklamb
pastorjacklamb / gist:5786890
Last active December 18, 2015 12:59
shortcode to list all licenses for EDD [license_list]
/*
* Prints a list of all licenses for a user ID
*/
function jack_edd_license_list($customer) {
$purchases = edd_get_users_purchases( $customer, 20, true );
if ( $purchases ) :
foreach ( $purchases as $purchase ) : setup_postdata( $purchase );
$downloads = edd_get_payment_meta_downloads( $purchase->ID );
//echo '<pre>'; print_r( $downloads ); echo '</pre>';
@pastorjacklamb
pastorjacklamb / gist:5779467
Created June 14, 2013 04:29
Change license length for bundles in Easy Digital Downloads. I have individual products with a lifetime (25 year license). But the bundle is a membership that renews annually. So this function changes the license length for bundled products to only 1 year.
add_action( 'edd_sl_store_license', 'jack_edd_license_length_options', 10, 3 );
function jack_edd_license_length_options( $license_id, $download_id, $payment_id ) {
$purchase_details = edd_get_payment_meta_cart_details( $payment_id, $include_bundle_files = true);
$item = array();
foreach( $purchase_details as $item ) {
if( edd_is_bundled_product( $item['id'] ) ) {
$bundled_products = edd_get_bundled_products( $download_id );
foreach( $bundled_products as $bundle_item ) {