Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
jamiemitchell / functions.php
Last active December 16, 2015 01:59 — forked from GaryJones/functions.php
Genesis Grid Loop Advanced
<?php
/**
* Possibly amend the loop.
*
* Specify the conditions under which the grid loop should be used.
*
* @author Bill Erickson
* @author Gary Jones
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
<?php
/**
* Template Name: Testimonial Archives
* Description: Used as a page template to show page contents, followed by a loop through a CPT archive
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_loop' ); // Add custom loop
@jamiemitchell
jamiemitchell / functions.php
Last active December 16, 2015 12:08
Get Title for the Top Level Parent Page Still working on this
<?php
function get_top_level_parent_title() {
global $post;
if ( empty($post->post_parent) )
{ the_title(); }
else {
$ancestors = get_post_ancestors($post->ID);
end($ancestors);
@jamiemitchell
jamiemitchell / functions.php
Last active December 16, 2015 12:08
Add login/logout link to naviagation menu
<?php
/*Add login/logout link to naviagation menu
------------------------------------------------------------ */
function add_login_out_item_to_menu( $items, $args ){
//change theme location with your them location name
if( is_admin() || $args->theme_location != 'primary' )
return $items;
@jamiemitchell
jamiemitchell / functions.php
Created April 29, 2013 14:18
Add Login/out to primary nav
<?php
/* Add Login/out to primary nav
------------------------------------------------------------ */
add_filter('wp_nav_menu_items','my_item', 11, 2);
function my_item($items, $args) {
if( is_admin() || $args->theme_location != 'primary' )
return $items;
<?php
/**
* Don't show Events category on homepage
* Category 5 = Events category, so we use cat=-5
*
* @link http://www.billerickson.net/thesis-wordpress-remove-category-homepage/
* @author Bill Erickson
* @param object $query
*/
@jamiemitchell
jamiemitchell / functions.php
Last active December 16, 2015 20:38
Remove the post meta in Genesis
<?php
/* Remove the post meta function
------------------------------------------------------------ */
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
<?php
// Enqueue sticky menu script
add_action( 'wp_enqueue_scripts', 'custom_enqueue_script' );
function custom_enqueue_script() {
wp_enqueue_script( 'sticky-menu', get_stylesheet_directory_uri() . '/js/sticky-menu.js', array( 'jquery' ), '', true );
}
// Reposition the secondary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
@jamiemitchell
jamiemitchell / functions.php
Created May 5, 2013 03:50
Remove the post info in Genesis
<?php
/* Remove the post info function
------------------------------------------------------------ */
remove_action( 'genesis_before_post_content', 'genesis_post_info' )