Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 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 / 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 16, 2014 18:06
Set slider defaults in v2 of Soliloquy.
<?php
/**
* Add Soliloquy defaults.
*/
add_filter( 'soliloquy_defaults', 'tgm_soliloquy_default_settings', 20, 2 );
function tgm_soliloquy_default_settings( $defaults, $post_id ) {
$defaults['slider_width'] = 800; // Slider width.
$defaults['slider_height'] = 400; // Slider height.
$defaults['control'] = 0; // Turns navigation pagination off by default.
@brycejacobson
brycejacobson / functions.php
Created April 24, 2014 14:32
Add custom post types to archives in WordPress
<?php
// Add custom post types to archives
function namespace_add_custom_types( $query ) {
if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
$post_types = get_post_types( '', 'names' );
$query->set( 'post_type', $post_types);
return $query;
}
}