Skip to content

Instantly share code, notes, and snippets.

View PurpleHippoDesign's full-sized avatar

Angie Vale PurpleHippoDesign

View GitHub Profile
@PurpleHippoDesign
PurpleHippoDesign / rss-mailchimp-email
Created November 4, 2014 14:28
Mailchimp RSS Email Template
*|RSSITEMS:|*
<h2 class="mc-toc-title"><a href="*|RSSITEM:URL|*" target="_blank">*|RSSITEM:TITLE|*</a></h2>
<br />
*|RSSITEM:CONTENT_FULL|*<br />
<a href="*|RSSITEM:URL|*" target="_blank">Read in browser &raquo;</a><br />
*|RSSITEM:SHARE:Facebook,Twitter|*&nbsp;*|RSSITEM:PLUSONE|*<br />
*|END:RSSITEMS|*<br />
&nbsp;
<h3 class="h3">Recent Articles:</h3>
*|RSS:RECENT|*
@PurpleHippoDesign
PurpleHippoDesign / add-cpt-to-rss.php
Last active August 29, 2015 14:08
Add CPT to RSS Feed
<?php
// Note: Add only code below to your functions.php
// Add custom post types - cpt1 and cpt2 to main RSS feed.
function mycustomfeed_cpt_feed( $query ) {
if ( $query->is_feed() )
$query->set( 'post_type', array( 'post', 'cpt1', 'cpt2' ) );
return $query;
}
add_filter( 'pre_get_posts', 'mycustomfeed_cpt_feed' );
@PurpleHippoDesign
PurpleHippoDesign / taxonomy-filter.php
Last active August 29, 2015 14:05
Adds category filter for custom post types
<?php // get rid of this tag
// Filter the request to just give posts for the given taxonomy, if applicable.
function taxonomy_filter_restrict_manage_posts() {
global $typenow;
$post_types = get_post_types( array( '_builtin' => false ) );
if ( in_array( $typenow, $post_types ) ) {
$filters = get_object_taxonomies( $typenow );
@PurpleHippoDesign
PurpleHippoDesign / remove-post-info-for-cpt.php
Created June 26, 2014 16:07
Remove post info and post info on custom post type
<?php // Get rid of this tag
// Remove Post Info, Post Meta from CPT
function pbh_remove_post_info() {
if( 'testimonial' == get_post_type() ) {
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
}
}
@PurpleHippoDesign
PurpleHippoDesign / conditional-tag-for-multiple-cpt.php
Last active August 29, 2015 14:03
Conditional tag for multiple custom post types
<?php // Get rid of this tag
// Remove Post Info and Post Meta from Custom Post Types
function pbh_remove_post_info() {
if ( in_array(get_post_type(), array ('testimonial', 'project'))) {
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
}
}
add_action ( 'get_header', 'pbh_remove_post_info' );
//* Remove page title form home page
add_action( 'get_header', 'child_remove_titles' );
function child_remove_titles() {
if ( is_front_page() ){
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
}
}
@PurpleHippoDesign
PurpleHippoDesign / add-image-to-single
Created May 16, 2014 11:13
Adds the featured image to single posts
// add featured image to single posts
add_action ( 'genesis_entry_header', 'pbh_featured_image_title_singular' );
function pbh_featured_image_title_singular() {
if ( !is_singular() || !has_post_thumbnail() )
return;
echo '<div class="singular-thumbnail">';
genesis_image( array( 'size' => 'medium' ) );
@PurpleHippoDesign
PurpleHippoDesign / add-multiple-genesis-grid-loops
Last active August 29, 2015 14:01
Adds Multiple Genesis Grid Loops Displaying Different Categories
<?php
//* Do NOT include the opening php tag
//* Add multiple grid loops to a page template*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_grid_loop' ); // Add custom loop
function custom_do_grid_loop() {
$args = array(
<?php // Get rid of this tag
//* Register widget areas
genesis_register_sidebar( array(
'id' => 'after-entry',
'name' => __( 'After Entry', 'theme-prefix' ),
'description' => __( 'This is the after entry section.', 'theme-prefix' ),
) );
//* Hooks after-entry widget area to single posts