Skip to content

Instantly share code, notes, and snippets.

@bryanwillis
bryanwillis / gfm.php
Created January 9, 2016 00:14 — forked from secretstache/gfm.php
Genesis Markup for Foundation
<?php
function ssfg_add_markup_class( $attr, $context ) {
// default classes to add
$classes_to_add = apply_filters ('ssfg-classes-to-add',
// default foundation markup values
array(
'site-header' => 'row',
'site-container' => 'inner-wrap',
'site-footer' => 'row',
'content-sidebar-wrap' => 'row',
@bryanwillis
bryanwillis / genesis-header-right-div.php
Created January 8, 2016 23:29 — forked from robneu/genesis-header-right-div.php
By default, the Genesis header-right widget area uses an <aside> element. While this is fine most of the time, if you're using the header-right section for your primary navigation it is probably less than ideal for it to be wrapped in an <aside>. This will change the <aside> to a standard <div> element.
<?php
add_filter( 'genesis_markup_header-widget-area_output', 'prefix_opening_header_div', 10, 2 );
/**
* Replace the opening header-right <aside> tag with a <div> tag to allow the
* primary nav to be used in the header without being wrapped in an aside tag.
*
* @param $tag string The current tag for the .header-right widget area.
* @param $args array The current args for genesis_attr()
* @return $tag string The modified tag for the .header-right widget area.
<?php
//* Do NOT include the opening php tag
add_action( 'get_header', 'sk_posts_in_columns' );
function sk_posts_in_columns() {
if ( is_home() || is_archive() ) {
//* Display as columns
add_filter( 'post_class', 'sk_display_in_columns' );
@bryanwillis
bryanwillis / template_fwcblgpost.php
Created December 22, 2015 05:25 — forked from cpaul007/template_fwcblgpost.php
Full Width Page Content with Latest Blog Posts
<?php
/*
Template Name: Full Width Content with Blog Posts
*/
//* Add outreach-pro-home body class
add_filter( 'body_class', 'custom_body_class' );
function custom_body_class( $classes ) {
<?php
/**
* This file adds widgetized Home Page.
*
*/
add_action( 'get_header', 'prefix_home_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
//* Add the site tagline section
add_action( 'genesis_after_header', 'minimum_site_tagline' );
function minimum_site_tagline() {
if (is_home() )
printf( '<div %s>', genesis_attr( 'site-tagline' ) );
genesis_structural_wrap( 'site-tagline' );
printf( '<div %s>', genesis_attr( 'site-tagline-left' ) );
printf( '<p %s>%s</p>', genesis_attr( 'site-description' ), esc_html( get_bloginfo( 'description' ) ) );
echo '</div>';
@bryanwillis
bryanwillis / acf_gen_attr01.php
Created December 15, 2015 08:18 — forked from SiGaCode/acf_gen_attr01.php
Use genesis_attr to add inline styles via ACF
// Add background-color to .footer-widgets
add_filter( 'genesis_attr_footer-widgets', 'ap_attributes_footer_widgets' );
function ap_attributes_footer_widgets( $attributes ) {
$background = get_field('footer_widgets_bg', option);
$attributes['style'] = 'background-color:' . $background . ';';
return $attributes;
}
@bryanwillis
bryanwillis / functions.php
Last active January 11, 2016 09:18 — forked from srikat/functions.php
Wrapping Primary and Secondary Navigation in custom divs in Genesis
//* Wrap .nav-primary in a custom div
add_filter( 'genesis_do_nav', 'genesis_child_nav', 10, 3 );
function genesis_child_nav($nav_output, $nav, $args) {
return '<div class="nav-primary-wrapper">' . $nav_output . '</div>';
}
//* Wrap .nav-secondary in a custom div
add_filter( 'genesis_do_subnav', 'genesis_child_subnav', 10, 3 );
@bryanwillis
bryanwillis / homeloop.php
Created December 5, 2015 20:11 — forked from neilgee/homeloop.php
Custom Genesis Home Loop with Character Limitation on Excerpt
<?php
//do not add in opening php tag
/**
* Custom Genesis Home Loop with Character Limitation on Excerpt
*
* @package Custom Genesis Home Loop with Character Limitation on Excerpt
* @author Neil Gee
* @link http://wpbeaches.com
* @copyright (c)2014, Neil Gee
@bryanwillis
bryanwillis / functions.php
Created December 4, 2015 00:21 — forked from robincornett/functions.php
optional home.php--to show the posts page's title and content
<?php
// do NOT include the opening line! Just add what's below to the end of your functions.php file
add_action( 'edit_form_after_title', 'rgc_posts_page_edit_form' );
function rgc_posts_page_edit_form() {
global $post, $post_type, $post_ID;
if ( $post_ID == get_option( 'page_for_posts' ) && empty( $post->post_content ) ) {
add_post_type_support( $post_type, 'editor' );
}