Skip to content

Instantly share code, notes, and snippets.

@brycejacobson
brycejacobson / functions.php
Created April 16, 2014 17:51
Add Soliloquy metabox support for posts and pages.
<?php
/**
* Add Soliloquy slider to posts and pages.
*/
add_filter( 'soliloquy_skipped_posttypes', 'tgm_soliloquy_skipped_posttypes' );
function tgm_soliloquy_skipped_posttypes( $post_types ) {
unset( $post_types['post'] );
unset( $post_types['page'] );
return $post_types;
@brycejacobson
brycejacobson / functions.php
Created April 10, 2014 21:24
Don't Strip HTML from Excerpts or Content Limit In WordPress
<?php
// Don't Strip HTML from Excerpts or Content Limit
add_filter('get_the_content_limit_allowedtags', 'childtheme_custom_allowedtags');
function childtheme_custom_allowedtags() {
return '<script>,<style>,<strong>,<b>,<br>,<em>'; //add whatever tags you want to this string
}
@brycejacobson
brycejacobson / page.php
Created April 9, 2014 17:35
WordPress Genesis custom post type loop
<?php
/**
* Genesis custom loop
*/
function be_custom_loop() {
global $post;
// arguments, adjust as needed
$args = array(
@brycejacobson
brycejacobson / functions.php
Created March 25, 2014 19:57
White Label Envira Gallery
<?php
// White label Envira Gallery
add_filter( 'gettext', 'tgm_envira_whitelabel', 10, 3 );
function tgm_envira_whitelabel( $translated_text, $source_text, $domain ) {
// If not in the admin, return the default string.
if ( ! is_admin() ) {
return $translated_text;
}
@brycejacobson
brycejacobson / pate-template.php
Created March 20, 2014 13:35
WordPress custom Genesis loop with grid option and content limit.
<?php
//* Custom loop to show work items
add_action( 'genesis_loop', 'soulo_work_loop' );
remove_action( 'genesis_loop', 'genesis_do_loop' );
function be_archive_post_class( $classes ) {
$classes[] = 'one-third';
global $wp_query;
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 3 )
@brycejacobson
brycejacobson / page-template.php
Created March 19, 2014 14:19
Remove link from entry title in Genesis.
<?php
//* Remove the link from each post title
add_filter( 'genesis_post_title_output', 'ytn_post_title_output', 15 );
function ytn_post_title_output( $title ) {
$title = sprintf( '<h2 class="entry-title">%s</h2> ', apply_filters( 'genesis_post_title_text', get_the_title() ) );
return $title;
}
@brycejacobson
brycejacobson / functions.php
Created March 14, 2014 13:03
Turn off pingbacks in WordPress.
<?php
//* Turn off pingbacks globably
add_filter( 'xmlrpc_methods', 'remove_xmlrpc_pingback_ping' );
function remove_xmlrpc_pingback_ping( $methods ) {
unset( $methods['pingback.ping'] );
return $methods;
} ;
@brycejacobson
brycejacobson / functions.php
Created February 18, 2014 15:35 — forked from thomasgriffin/gist:9071378
Remove width and height attributes from images in Soliloquy sliders.
<?php
add_action( 'tgmsp_callback_start', 'tgm_soliloquy_remove_image_attr' );
function tgm_soliloquy_remove_image_attr( $id ) {
$script = 'var slides = $(slider).find(".soliloquy-slides > li img");';
$script .= '$(slides).each(function(i){';
$script .= '$(this).removeAttr("width height");';
$script .= '});';
echo $script;
@brycejacobson
brycejacobson / wp-config.php
Created February 12, 2014 15:25
Enable background updates in WordPress on site where it fails.
<?php
/**
* Enabling automatic updates.
*/
define('FTP_USER', 'username');
define('FTP_PASS', 'password');
define('FTP_HOST', 'localhost');
@brycejacobson
brycejacobson / functions.php
Created February 11, 2014 17:14
Programmatically add menu Item in WordPress
<?php
add_filter( 'wp_nav_menu_items', 'add_logout_link', 10, 2);
/**
* Add a login link to the members navigation
*/
function add_logout_link( $items, $args )
{
if($args->theme_location == 'site_navigation')