Skip to content

Instantly share code, notes, and snippets.

@neilgee
neilgee / mod-primary-nav.php
Last active December 4, 2015 07:28
Reposition Genesis Primary Navigation to Header Right Widget and Remove Structural Wrap
<?php
//do not copy the opening php tag above
/**
* Swap Primary Nav to Header Right and Remove Wrap
*
* @package Swap Primary Nav
* @author Neil Gee
* @link http://coolestguidesontheplanet.com/switching-primary-menu-genesis-theme-header-right/
* @copyright (c) 2014, Neil Gee
add_filter('the_content_feed', 'wpsitesdotnet_post_thumbnail_rss');
add_filter('the_excerpt_rss', 'wpsitesdotnet_post_thumbnail_rss');
function wpsitesdotnet_post_thumbnail_rss($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '' . get_the_post_thumbnail( $post->ID, 'featured-img', array( 'style' => 'align:centre; margin-bottom:40px; height: 300px; width: 600px;' ) ) . '' . $content;
}
return $content;
}
/**
* @author Brad Dalton WP Sites
* @link http://wpsites.net/blog
*/
add_action( 'genesis_after_post_content', 'custom_post_type_nav', 5 );
function custom_post_type_nav() {
if( 'portfolio' == get_post_type() && is_single() )
return;
@srikat
srikat / functions.php
Last active January 2, 2016 04:59
Implementing smooth scrolling to in-page links in any Genesis theme. http://sridharkatakam.com/smooth-scrolling-page-links-genesis-theme/
/**
* Enqueue scripts for smooth scrolling
*/
add_action( 'wp_enqueue_scripts', 'sk_smooth_scroll' );
function sk_smooth_scroll() {
wp_enqueue_script( 'scrollTo', get_stylesheet_directory_uri() . '/js/jquery.scrollTo.min.js', array( 'jquery' ), '1.4.5-beta', true );
wp_enqueue_script( 'localScroll', get_stylesheet_directory_uri() . '/js/jquery.localScroll.min.js', array( 'scrollTo' ), '1.2.8b', true );
wp_enqueue_script( 'scrollto-init', get_stylesheet_directory_uri() . '/js/scrollto-init.js', array( 'localScroll' ), '', true );
@srikat
srikat / functions.php
Last active January 5, 2016 05:54
App style off-canvas menus and sidebars using Slidebars in Genesis. http://sridharkatakam.com/app-style-canvas-menus-sidebars-using-slidebars-genesis/
//* Add #sb-site to .site-container div
add_filter( 'genesis_attr_site-container', 'custom_genesis_attributes_entry' );
/**
* Add attributes for entry element.
*
* @since 2.0.0
*
* @param array $attributes Existing attributes.
*
* @return array Amended attributes.
@nickcernis
nickcernis / style.css
Last active January 20, 2016 02:36
Simple Social Icons font conflict fix
@font-face {
font-family: 'ssi-fontello';
src: url('../font/fontello.eot?78492063');
src: url('../font/fontello.eot?78492063#iefix') format('embedded-opentype'),
url('../font/fontello.woff?78492063') format('woff'),
url('../font/fontello.ttf?78492063') format('truetype'),
url('../font/fontello.svg?78492063#fontello') format('svg');
font-weight: normal;
font-style: normal;
}
@srikat
srikat / archive-communities.php
Last active March 17, 2016 19:14
How to change Portfolio CPT to Communities in Minimum Pro. http://sridharkatakam.com/change-portfolio-cpt-communities-minimum-pro/
<?php
/**
* The custom communities post type archive template
*/
//* Force full width content layout
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
//* Add even/odd post class
add_filter( 'post_class', 'minimum_even_odd_portfolio_post_class' );
@renventura
renventura / archive-movie.php
Last active June 10, 2016 23:28
Archive template for movie post type
<?php //* Mind this opening PHP tag
/**
* Movie Archive Template
*
* Note that the hooks and genesis_get_image() function used in this file are specific to the Genesis Framework
*
* @author Ren Ventura <EngageWP.com>
* @link http://www.engagewp.com/nested-loops-custom-wordpress-queries
*/
@JiveDig
JiveDig / post_class_columns.php
Last active June 11, 2016 00:06
Use post_class (post class) to break post into columns Last example shows how to conditionally use post class, for specific templates or pages
/**
* Breaks the posts into 4 columns
* @link http://www.billerickson.net/code/grid-loop-using-post-class
*/
add_filter( 'post_class', 'tsm_archive_post_class' );
function tsm_archive_post_class( $classes ) {
global $wp_query;
// Keeps columns out of secondary loops ie: Genesis Featured Post widgets
if( ! $wp_query->is_main_query() ) {
return $classes;
@neilgee
neilgee / front-page.php
Last active August 29, 2016 02:52
Genesis Remove Home Page Content
<?php //<~ Add me in
add_action( 'genesis_before_content', 'ng_home_page_widgets' );
/*
* Add the home widgets in place
*/
function ng_home_page_widgets() {
genesis_widget_area ('content-1', array(