Skip to content

Instantly share code, notes, and snippets.

@robincornett
robincornett / functions.php
Created July 9, 2013 00:25
hook the Genesis search form anywhere (here, above the sidebar--necessary as secondary nav was also hooked above sidebar so needed this to place search above secondary nav). Genesis 2.0
<?php
//* Insert a Genesis search form above the primary sidebar widget area (in lieu of using a widget due to secondary nav or other bing placed above the sidebar) */
add_action( 'genesis_before_sidebar_widget_area', 'rgc_do_search' );
function rgc_do_search() {
echo '<aside class="widget">';
get_search_form();
echo '</aside>';
}
@robincornett
robincornett / blog_featuredimage.php
Last active December 20, 2015 01:39
New blog template using featured images (for Genesis 2.0/HTML5)
<?php
/**
* Template Name: Featured Image Blog Template
* Description: Use with query_args to show the featured medium image only of all called posts/pages.
* @author Robin Cornett
* @package Lookout 2013
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'genesis_standard_loop', 5 ); // show the editor content
@robincornett
robincornett / functions.php
Created August 6, 2013 11:49
on a site set to show the full content of each post (due to Tribe events calendar), set page_blog.php to return the featured image and content limit.
<?php
add_action ( 'genesis_entry_content' , 'rgc_blog_page' );
function rgc_blog_page () {
if ( !is_page ( array( 'pastors' , 'sermons' ) ) && is_page_template( 'page_blog.php' ) ) {
remove_action ( 'genesis_entry_content' , 'genesis_do_post_content' );
add_action ( 'genesis_entry_content' , 'rgc_blog_content' );
}}
function rgc_blog_content () {
echo '<a href="' . get_permalink() .'" title="' . the_title_attribute( 'echo=0' ) . '">'; // Original Grid
@robincornett
robincornett / functions.php
Created August 20, 2013 14:29
IE8 styling
<?php
add_action( 'wp_enqueue_scripts', 'child_add_ie8_style_sheet', 200 );
/**
* Enqueue a IE-specific style sheet.
*
* Add a style sheet for everyone, then mark it as conditional to IE7 or below.
*
* @author Gary Jones
* @link http://code.garyjones.co.uk/enqueued-style-sheet-extras/
@robincornett
robincornett / style.css
Last active December 22, 2015 05:39
styling for smaller images on responsive sites. in effect at smallest (phone) screen sizes.
@media only screen and (max-width: 767px) {
.featuredpost .alignleft, /* featured post widget */
.featuredpost .alignright,
img.alignright, /* standard image in content */
img.alignleft,
.wp-caption.alignleft, /* if you ever use smaller images with captions */
.wp-caption.alignright {
display: block;
margin: 0 auto 24px;
float: none;
@robincornett
robincornett / archive-staff.php
Last active December 23, 2015 09:19
Cool effect for an archive page (in this case, a staff page such as http://smtwo.org/staff/) to conserve room. Click on thumbnails and full descriptions fade in and out.
<?php
//* Remove the entry meta in the entry header
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_loop' ); // Add custom loop
function custom_do_loop() {
@robincornett
robincornett / front-page.php
Last active September 7, 2017 20:51
Masonry layout for custom front page (using widgets), as seen on smtwo.org
<?php
//* Front page for smtwo
add_action( 'genesis_meta', 'rgc_fp_meta' );
function rgc_fp_meta() {
if (is_active_sidebar( 'home-main') ) {
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'rgc_home_loop' );
}
@robincornett
robincornett / page_tax.php
Last active February 10, 2017 13:08
Genesis page template to show a list of terms from a taxonomy. Add a custom field in the page editor. query_args, value is the name of your taxonomy. (updated 4/5/2016 to allow for error due to invalid taxonomy name)
<?php
/**
* Template Name: Taxonomy Listing
* This file lists taxonomies on a page. Based on http://codex.wordpress.org/Function_Reference/get_term_link
*
* @author Robin Cornett
* @link http://robincornett.com/taxonomy-list/
*/
add_action( 'genesis_entry_content', 'robin_do_taxonomy_loop' ); // Add custom loop
function robin_do_taxonomy_loop() {
@robincornett
robincornett / fluidvids.js
Created November 23, 2013 01:48
Use this to add fluidvids to your theme for responsive videos (https://github.com/toddmotto/fluidvids)
/*
Fluid and Responsive YouTube/Vimeo Videos v1.0.0
by Todd Motto: http://www.toddmotto.com
Latest version: https://github.com/toddmotto/fluidvids
Copyright 2013 Todd Motto
Licensed under the MIT license
http://www.opensource.org/licenses/mit-license.php
A raw JavaScript alternative to FitVids.js, fluid width video embeds
@robincornett
robincornett / functions.php
Created January 12, 2014 20:54
Resize photos for email/RSS feed
<?php
/**
* Filters images for RSS feed--makes thumbs go through large; large images resize down to MailChimp friendly width.
* Add this to your functions.php file WITHOUT the opening php
*
* Author: Erik Teichmann, minor tweaks by Robin Cornett
* Author URI: http://www.eriktdesign.com/
*/