Skip to content

Instantly share code, notes, and snippets.

View davebonds's full-sized avatar

Dave Bonds davebonds

View GitHub Profile
@davebonds
davebonds / ae_change_listing_posts_per_page.php
Created March 26, 2014 23:56
Change Posts Per Page for Listing Archive
add_action( 'pre_get_posts', 'ae_change_listing_posts_per_page' );
/**
* Change Posts Per Page for Listing Archive
*/
function ae_change_listing_posts_per_page( $query ) {
if( $query->is_main_query() && !is_admin() && is_post_type_archive( 'listing' ) ) {
$query->set( 'posts_per_page', '18' );
}
@davebonds
davebonds / genesis_content_width_filter.php
Created March 27, 2014 02:31
Modifying the $content_width variable in Genesis
/* The 3 numbers correspond to the content width of the default, small and large layouts.
* The default layout refers to 2-column layouts; small refers to 3-column layouts
* and large refers to the full-width content layout.
*/
$content_width = apply_filters( 'content_width', 580, 480, 900 );
<div class="address clearfix">
<p>Address:</p>
<div class="address-right">
<p>7908 Van Ness</p>
<p>San Francisco, CA 94510</p>
</div>
</div>
<div class="phone clearfix">
<p>Phone:</p>
@davebonds
davebonds / single-listing.php
Last active August 29, 2015 13:59
snippet to show connected agents on single listings using WP Listings or AgentPress
add_action( 'genesis_after_post', 'aeprofiles_show_connected_agent' ); // XHTML
add_action( 'genesis_after_entry', 'aeprofiles_show_connected_agent' ); // HTML5
function aeprofiles_show_connected_agent() {
if (function_exists('_p2p_init') && function_exists('agentpress_listings_init') || function_exists('_p2p_init') && function_exists('wp_listings_init')) {
echo'
<div class="connected-agents">';
aeprofiles_connected_agents_markup();
echo '</div>';
}
function add_video_wmode_transparent($html, $url, $attr) {
if ( strpos( $html, "<embed src=" ) !== false )
{ return str_replace('</param><embed', '</param><param name="wmode" value="opaque"></param><embed wmode="opaque" ', $html); }
elseif ( strpos ( $html, 'feature=oembed' ) !== false )
{ return str_replace( 'feature=oembed', 'feature=oembed&wmode=opaque', $html ); }
else
{ return $html; }
}
add_filter( 'embed_oembed_html', 'add_video_wmode_transparent', 10, 3);
//Filter the Taxonomy Meta on a CPT
function themeprefix_genesis_post_meta_filter( $post_meta ) {
if ( 'coaching_technique' == get_post_type() ) {//swap in CPT name
$post_meta='[post_terms taxonomy="difficulty-level" before="Difficulty Level: "]';//swap in taxonomy and label name
return $post_meta;
}
}
add_filter( 'genesis_post_meta','themeprefix_genesis_post_meta_filter', 11 );
<?php
/**
* This file adds a Landing template to any Agent Evolution Genesis Child Theme.
*
* @author Agent Evolution
* REPLACE themename WITH THE NAME OF YOUR THEME
*/
/*
Template Name: Landing
@davebonds
davebonds / single-listing.php
Created May 1, 2014 02:25
This file adds the AgentPress Listing single template to any Agent Evolution theme
<?php
/**
* This file adds the AgentPress Listing single template to any Agent Evolution theme
*/
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
remove_action( 'genesis_after_entry', 'genesis_do_author_box_single' );
// Uncomment the following line enable comments on listings
// remove_action( 'genesis_after_entry', 'genesis_get_comments_template' );
<?php
/**
* This file adds the AgentPress Listing archive template to any Agent Evolution Theme.
*
* @author Agent Evolution
* @package Move-in Ready
* @subpackage AgentPress Listings
*/
/**
@davebonds
davebonds / custom-menu-links-widget.php
Last active August 29, 2015 14:01 — forked from isGabe/custom-menu-links-widget.php
Custom Menu widget with description