Skip to content

Instantly share code, notes, and snippets.

@leepettijohn
leepettijohn / functions.php
Created October 18, 2016 16:00
Move post title around other content (HTML5)
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
add_action ('genesis_before_entry_content','add_before_title');
add_action( 'genesis_before_entry_content', 'genesis_do_post_title' );
function add_before_title(){
echo 'do something';
}
@leepettijohn
leepettijohn / functions.php
Created October 18, 2016 11:12
Force page layout (full width / content sidebar)
/** Force full width layout */
add_filter( 'genesis_pre_get_option_site_layout', 'child_do_layout' );
function child_do_layout( $opt ) {
if ( is_single() ) { // Modify the conditions to apply the layout to here
$opt = 'full-width-content'; // You can change this to any Genesis layout
return $opt;
}
}
@leepettijohn
leepettijohn / functions.php
Created October 13, 2016 20:38
Genesis Font Awesome Embed Script
//enqueues our external font awesome stylesheet
function enqueue_our_required_stylesheets(){
wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css');
}
add_action('wp_enqueue_scripts','enqueue_our_required_stylesheets');
@leepettijohn
leepettijohn / functions.php
Created October 3, 2016 10:12
Order Posts by order number
/* Also, add the plugin Simple Page Ordering to enable the ability to drag and drop posts to a specified order
add_action( 'genesis_before_loop', 'ntg_do_query' );
/** Changes the Query before the Loop */
function ntg_do_query() {
$posttype = get_post_type();
if( $posttype == 'portfolio'){
global $query_string;
query_posts( wp_parse_args( $query_string, array( 'orderby' => 'menu_order', 'order' => 'ASC' ) ) );
@leepettijohn
leepettijohn / center.html
Created September 29, 2016 17:43
Center div between two different sized divs
<style>
div{height:100px}
.left{float:left; width:100px;}
.right{float:right; width:300px;}
.middle-wrap{overflow:hidden}
.middle{margin:0 auto; width:50px}
</style>
<div class="left"></div>
<div class="right"></div>
<div class="middle-wrap">
@leepettijohn
leepettijohn / functions.php
Created August 18, 2016 10:57
WordPress Gallery to Flexslider
//shout to Tiffany Brown - https://tiffanybbrown.com/2014/09/using-flexslider-with-wordpress/index.html
function build_gallery_content( $attrs ){
static $instance = 0;
$instance++;
/*
Limiting what the user can do by
locking down most short code options.
*/
@leepettijohn
leepettijohn / functions.php
Created July 1, 2016 15:48
Add a READ MORE link to the excerpt function
function new_excerpt_more($more) {
return '';
}
add_filter('excerpt_more', 'new_excerpt_more', 21 );
function the_excerpt_more_link( $excerpt ){
$post = get_post();
$excerpt .= '<a href="'. get_permalink($post->ID) . '">continue reading</a>';
return $excerpt;
}
@leepettijohn
leepettijohn / functions.php
Created June 24, 2016 18:10
Genesis - Add search icon to search box and change search text
<?php
//* Do NOT include the opening php tag
//* Enqueue Dashicons
//* CHECK YOUR functions.php FILE FIRST!
add_action( 'wp_enqueue_scripts', 'b3m_enqueue_dashicons' );
function b3m_enqueue_dashicons() {
wp_enqueue_style( 'dashicons' );
}
@leepettijohn
leepettijohn / index.html
Created June 24, 2016 17:26
Middle floating div between two fixed divs
<div id="leftCol">Left</div>
<div id="rightCol">Right</div>
<div id="centerCol">Center</div>
@leepettijohn
leepettijohn / script.js
Created June 22, 2016 21:46
jQuery - Append to link href / url
var _href = $("a.variables").attr("href");
$("a.variables").attr("href", _href + '?id='+ $_GET["id"]);