Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block davechu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
davechu / Utility Pro small bugfix
Last active Jul 19, 2016
This change's purpose is to correctly remove Backstretch from pages that use the Utility Pro landing page. This fix goes in enqueue-assets.php.
View Utility Pro small bugfix
// Load remaining scripts only if custom background is being used
// and we're on the home page or a page using the landing page template
// dave bugfix - had to move the "not" to be specifically on is_front_page to take backstretch out of landing page.
if ( ! get_background_image() || ( ( ! is_front_page() || is_page_template( 'page_landing.php' ) ) ) ) {
/*** old code so you can see what changed.
if ( ! get_background_image() || ( ! ( is_front_page() || is_page_template( 'page_landing.php' ) ) ) ) {
davechu / PHP literal text example
Last active Jul 12, 2016
"EOT" marks the beginning and end of the text string. Note the last line, which must begin at the beginning of a new line or it won't work.
View PHP literal text example
echo <<< EOT
<div class="customLogos">
<div class="cLogoHolder">
<a href=""><img src="/wp-content/themes/x/tribe-events/community/images/www.png" alt="" /></a>
<a href=""><img src="/wp-content/themes/x/tribe-events/community/images/www_edited.png" alt="" /></a>
davechu / Genesis Auto Submenu
Last active Feb 1, 2016
This is code that will allow the use of Christian Varga's handy WordPress auto-submenu code.
View Genesis Auto Submenu
/** dave's genesis code for making the submenu **/
add_action( 'wp_head', 'dc_add_tricky_menu' );
function dc_add_tricky_menu () {
// make all menus one level, or else dropdowns will be redundant in your submenu.
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );
// stick submenu under main menu. Of course you can use other hooks to put menu & submenu elsewhere.
add_action( 'genesis_after_header', 'dc_add_tricky_two' );
function my_wp_nav_menu_args( $args = '' ) {
davechu / Changing title attributes
Created Jul 29, 2014
For Veit. Here's how to change itemprop for site title or entry title in Genesis. These go in your functions.php of your child theme.
View Changing title attributes
add_filter( 'genesis_attr_site-title', 'dc_veit_site_title' );
function dc_veit_site_title( $attributes ) {
$attributes['itemprop'] = 'nonheadline';
return $attributes;
add_filter( 'genesis_attr_entry-title', 'dc_veit_entry_title' );
function dc_veit_entry_title( $attributes ) {
$attributes['itemprop'] = 'whatever';
return $attributes;
davechu / Alter "You are here" on breadcrumbs in Genesis
Created Oct 2, 2015
For Bjorne. This bit of code goes in your theme's functions.php. Notice how I have 2 variations, the commented one removes that completely, the next one replaces the original text.
View Alter "You are here" on breadcrumbs in Genesis
add_filter( 'genesis_breadcrumb_args', 'dc_breadcrumb_args' );
function dc_breadcrumb_args( $args ) {
//$args['labels']['prefix'] = '';
$args['labels']['prefix'] = 'Du är här';
return $args;
davechu / Remove link from Auberge WordPress theme Featured Images
Created Sep 22, 2015
When you make a child theme of Auberge, you can use this code in your functions.php to remove the links from Featured Images on pages. If this sounds scary, ask a developer to do it. :)
View Remove link from Auberge WordPress theme Featured Images
davechu / If using an SEO plugin with Genesis, remove the duplicate meta description as well as Genesis SEO meta boxes on Posts and Pages.
Last active Sep 17, 2015
Genesis SEO settings do have some code that will disable parts of itself when it "sees" certain SEO plugins. I wanted to disable more, including a duplicate Meta Description tag (possibly a bug). I had also tried the command that simply shuts of all of Genesis SEO, but that knocked the page titles out of my theme!
View If using an SEO plugin with Genesis, remove the duplicate meta description as well as Genesis SEO meta boxes on Posts and Pages.
// kill genesis meta description when using another SEO plugin. also remove genesis SEO metas from posts.
remove_action( 'genesis_meta','genesis_seo_meta_description' );
remove_action( 'admin_menu', 'genesis_add_inpost_seo_box' );
davechu / Genesis generic attribute filtering examples
Created Sep 9, 2015
The idea is to use the genesis_attr_{some-class-or-html-tag} format. Your class (or HTML tag) must only occur once on the page for it to work. Notice that I concatenate the class so that existing classes don't get lost.
View Genesis generic attribute filtering examples
add_filter( 'genesis_attr_site-inner', 'dc_modify_site_inner_attr' );
function dc_modify_site_inner_attr( $attributes ) {
$attributes['itemtype'] = '';
$attributes['class'] .= ' myNewClass';
return $attributes;
add_filter( 'genesis_attr_head', 'dc_modify_head_attr' );
function dc_modify_head_attr( $attributes ) {
$attributes['itemtype'] = '';
davechu / add attribute to sidebar in Genesis
Last active Sep 9, 2015
For emmtre. In place of sidebar-primary, sidebar-secondary and footer-widgets should also work. Notice how I'm concatenating the class and leaving a space; if you just assign a value to it, you'll remove your other classes from the sidebar, and the visual results will be dramatic! :)
View add attribute to sidebar in Genesis
add_filter( 'genesis_attr_sidebar-primary', 'dc_modify_widget_area_attr' );
function dc_modify_widget_area_attr( $attributes ) {
$attributes['itemtype'] = '';
$attributes['class'] .= ' prettyproduct';
return $attributes;
davechu / Adding HEAD attribute in Genesis for WordPress
Last active Sep 4, 2015
You can add any attribute you like to the HEAD tag. As you can see, I added a joke one here under the real one. :)
View Adding HEAD attribute in Genesis for WordPress
add_filter( 'genesis_attr_head', 'dc_modify_head_attr' );
function dc_modify_head_attr( $attributes ) {
$attributes['itemtype'] = '';
$attributes['bogusnewthing'] = 'brandnewwhatever';
return $attributes;
You can’t perform that action at this time.