Skip to content

Instantly share code, notes, and snippets.

@robneu
robneu / genesis-front-end-color-switcher.php
Last active December 7, 2016 13:41
Genesis child theme front end color switcher
<?php
/**
* Define color choices for a Genesis Child Theme
* and then set up a way for them to be changed from the
* front end in a theme demo.
*
* @author FAT Media <http://youneedfat.com>
* @copyright Copyright (c) 2013, FAT Media, LLC
* @license GPL-2.0+
*/
@robneu
robneu / disable-fallback-image-genesis.php
Created September 3, 2013 17:51
If you've noticed that since the latest Genesis 2.0 update all of your blog posts have featured images even if you haven't set them, it's because of a new feature added in Genesis 2.0. Lots of people like this, but some people might not want to automatically set fallback images for their posts. This allows you to disable the fallback image.
<?php
/**
* The latest version of Genesis sets a fallback image
* for posts that don't have a featured image set.
* This disables the feature.
*
* @author FAT Media <http://youneedfat.com>
* @copyright Copyright (c) 2013, FAT Media, LLC
* @license GPL-2.0+
*/
@robneu
robneu / wordpress-widgeted-page-template-helper.php
Last active December 22, 2015 14:09
Sometimes you might want to create a custom page template that is built entirely using widgets. This can give your content a lot of flexibility for the end user; however, it could also be confusing. If you're not using the standard WordPress editor at all in your template, you should disable it and explain why it has been removed. This code will…
<?php
/**
* If your theme or plugin has a page template that
* uses widgets to build the layout, users might be
* confused as to why the standard editor doesn't
* work as expected. This will disable the editor
* and introduce a notice explaining its absence.
*
* @author FAT Media <http://youneedfat.com>
* @copyright Copyright (c) 2013, FAT Media, LLC
@robneu
robneu / wordpress-change-category-posts-per-page.php
Last active January 26, 2021 09:05
Set the number of posts per page in all WordPress category archives using pre_get_posts.
<?php
add_action( 'pre_get_posts', 'prefix_category_query' );
/**
* Customize category query using pre_get_posts.
*
* @author FAT Media <http://youneedfat.com>
* @copyright Copyright (c) 2013, FAT Media, LLC
* @license GPL-2.0+
* @todo Change prefix to theme or plugin prefix
@robneu
robneu / genesis-column-classes.css
Last active December 23, 2015 01:29
Genesis Column Classes - 2.x Bootstrap Version
/* Column Classes
Link: http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css
--------------------------------------------- */
.five-sixths,
.four-sixths,
.one-fourth,
.one-half,
.one-sixth,
.one-third,
<?php
/**
* Displays a signature image after the post content in
* any Genesis Child theme.
*
* @author FAT Media <http://youneedfat.com>
* @copyright Copyright (c) 2013, FAT Media, LLC
* @license GPL-2.0+
*/
@robneu
robneu / delete-backstretch-stuff.php
Last active December 23, 2015 03:59
If you don't like backstretch, you might prefer to display a normal image instead. Once you've removed the enqueue scripts functions from front-page.php, all you need to do is output the background image by hooking it after the header.
<?php
//* Enqueue scripts
add_action( 'wp_enqueue_scripts', 'minimum_front_page_enqueue_scripts' );
function minimum_front_page_enqueue_scripts() {
//* Load scripts only if custom background is being used
if ( ! get_background_image() )
return;
@robneu
robneu / wordpress-seo-keywords-bs.php
Created September 16, 2013 13:40
WordPress SEO without a plugin is complete crap. Let's break it down one function at a time.
<?php
function basic_wp_seo() {
global $page, $paged, $post;
$default_keywords = 'wordpress, plugins, themes, design, dev, development, security, htaccess, apache, php, sql, html, css, jquery, javascript, tutorials'; // customize
$output = '';
// description
$seo_desc = get_post_meta($post->ID, 'mm_seo_desc', true);
$description = get_bloginfo('description', 'display');
$pagedata = get_post($post->ID);
@robneu
robneu / remove-genesis-post-info-category.php
Last active December 23, 2015 11:29
Conditionally remove the Genesis post info section from a single blog category on both single entries and archive pages.
<?php
/**
* Remove the post info on a Genesis xHTML theme
* in a single category that you specify.
*
* @author FAT Media <http://youneedfat.com>
* @copyright Copyright (c) 2013, FAT Media, LLC
* @license GPL-2.0+
*/
@robneu
robneu / genesis-searchwp-image-search.php
Last active September 14, 2019 21:25
Create a custom search template to display custom search results using SearchWP and the Genesis Framework.
<?php
/**
* This file adds the SearchWP Images template to your theme.
*
* Template Name: SearchWP Images
*
* @author Robert Neu
* @package Genesis
* @subpackage SearchWP
*/