Skip to content

Instantly share code, notes, and snippets.

View csbeck's full-sized avatar

Chris Becker csbeck

View GitHub Profile
@csbeck
csbeck / wp_genesis_custom_submenus
Created July 8, 2014 18:06
Genesis Custom Submenus (tabs)
/**
* Submenu customizations (tabs)
* Created by Becker Design Studio
* http://www.beckerstudio.com
**/
remove_action('genesis_after_header', 'genesis_do_subnav');
add_action('genesis_before_post_content','my_custom_subnav');
function my_custom_subnav () {
/* use if and else if statements to determine what page we're on to know what submenu to show */
if ( is_page(46) || is_page(185) || is_page(191) || is_page(196) ) {
@csbeck
csbeck / blog_page
Created January 7, 2014 23:07
Show content above Blog list page - WordPress + StudioPress
<?php
//* Show page content above posts
add_action( 'genesis_loop', 'genesis_standard_loop', 5 );
genesis();
@csbeck
csbeck / wp_php_code_in_widget
Created November 20, 2013 20:36
PHP code in WordPress widgets. Include this in the functions.php file.
// Add PHP functionality in Widgets
add_filter('widget_text','execute_php',100);
function execute_php($html){
if(strpos($html,"<"."?php")!==false){
ob_start();
eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
}
return $html;
@csbeck
csbeck / wp_search_in_category
Created November 20, 2013 20:34
Category search within a widget. Must include the PHP ability in widgets.
<!-- Search Form -->
<div style="margin:10px 0 10px 0;">
<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<table cellspacing="5">
<tr>
<td>
<label for="s" style="margin:10px;">Search in Categories</label>
</td>
<td>
<input type="text" class="field" name="s" style="width: 100px;"/>
@csbeck
csbeck / wp_customloginlogo
Created October 21, 2013 16:37
Add custom logo for WordPress login screen. Add it to the functions.php file.
@csbeck
csbeck / gist:5854118
Created June 24, 2013 22:08
Custom Archive Listing Page #01
<?php
/**
* Template Name: Professionals Listing Page
* 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
@csbeck
csbeck / page_feature_loop.php
Created June 21, 2013 00:03
Genesis Feature Loop Page with Content on the top
<?php
/**
* This file adds a custom Genesis Loop */
/*
Template Name: Feature Loop Page
*/
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_grid_loop_helper', 55 );
@csbeck
csbeck / gist:5605378
Created May 18, 2013 18:37
Page and Post - Custom text after Title but before content - Custom Admin Meta Box - (this is for adding to the functions.php - using Genesis framework)
<?php
/** Add custom meta box **/
add_action( 'add_meta_boxes', 'myplugin_add_custom_box' );
// backwards compatible (before WP 3.0)
// add_action( 'admin_init', 'myplugin_add_custom_box', 1 );
/* Do something with the data entered */
add_action( 'save_post', 'myplugin_save_postdata' );
@csbeck
csbeck / style.css
Last active December 14, 2015 22:08
style.css for MikeMetcalfe site
/*
Theme Name: eleven40 Child Theme
Theme URI: http://www.studiopress.com/themes/eleven40
Description: eleven40 is a two or three column child theme created for the Genesis Framework.
Author: StudioPress
Author URI: http://www.studiopress.com/
Version: 1.1
Tags: black, blue, green, orange, red, white, dark, light, three-columns, two-columns, left-sidebar, right-sidebar, fixed-width, custom-menu, featured-images, full-width-template, post-formats, sticky-post, theme-options, threaded-comments
@csbeck
csbeck / gist:5136217
Last active December 14, 2015 19:19
Advanced Custom Genesis Grid Template
<?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/