Code Snippets

Saving useful code as I find it, build it, or stumble into it.

Fork Me on GitHub

Pure CSS Parallax Page Header in Genesis

Add a parallax image behind a page entry header in Genesis - pure css solution. (You'll need to style your image to be tall enough to match the webpage header, so it is behind the main page header on scroll)

Exclude Post Types From Search

This snippet allows you to remove a post type, like pages, for instance, from the search results without removing any others (by default WordPress searches posts, pages, and attachments). This will also preserve any custom post types you might have that are searchable (like those from other plugins).

Get Post Types By Taxonomy

Get post types that have a specific taxonomy, returns an array of objects or names, or false if nothing found.

Post Avatars in Entry Header in Genesis

This places the post avatar in the entry header of feature posts (if you're using the grid loop plugin) and on single post pages. It also allows for co-author plus support, showing a different image when there is more than one author.


Checks if the current post is a custom post type, returns boolean. Very handy when working with custom post types, layouts and the like.

Alternate Sidebar Page Template in Genesis

This allows you to use the built-in secondary sidebar as an alternate on one sidebar themes (you'll want to register a separate sidebar if you are using two sidebars in your theme layouts). This has a limited scope, I would recommend a plugin like Display Widgets if you are going to have a more complicated page-by-page application.

Remove Default WordPress Taxonomies

Remove category and tag taxonomies. Useful if you're not using the blog functionality of WordPress, including the taxonomies. Be sure to uncomment the other line if you're using Genesis to avoid errors.

Force Genesis Post SEO Settings

This bit in your functions.php file will force specific settings for robots post meta. Change 'post' to a specific post type or replace with other conditional. This is handy for post types that you do not want to have single post pages included in search results, private pages, et cetera.