Skip to content

Instantly share code, notes, and snippets.

View timstl's full-sized avatar

Tim Gieseking timstl

View GitHub Profile
@timstl
timstl / tfield()
Last active August 29, 2015 14:07
ACF conditional the_field/get_field shortcut function
<?php
if (function_exists('get_field') && !function_exists('tfield'))
{
/*
Example usage:
<?php tfield('header_text', '<div class="entry">', '</div>'); ?>
*/
function tfield($field, $before='', $after='', $echo=true)
{
/* don't output if field doesn't have value. */
@timstl
timstl / debug_display
Last active August 29, 2015 14:06
Debug_Display debugging to screen function
<?php
/*
Based on debugging function found in CMS Made Simple http://www.cmsmadesimple.org/
Meant for use in WordPress (ability to only output to 'manage_options' users)
Pass in 'false' as section param to show to everyone.
*/
if (!function_exists('debug_display'))
{
function debug_display($var, $admins=true, $title="", $echo_to_screen = true, $use_html = true)
{
@timstl
timstl / maybe_ssl_url
Created August 22, 2014 14:17
maybe_ssl_url (for WordPress)
function maybe_ssl_url($url)
{
if (!is_ssl()) { return $url; }
return str_ireplace('http://', 'https://', $url);
}
@timstl
timstl / border-image-fallback
Last active August 29, 2015 13:59
Border-Image with Modernizr fallback for < IE11
.decbdr
{
border-bottom: 13px solid #ff6e00;
border-image:url('img/bg/decbdr.jpg') 0 0 100 0 repeat;
}
.no-borderimage .decbdr
{
border-bottom: 13px solid transparent;
position: relative;
@timstl
timstl / jquery.colequalize.js
Last active August 17, 2016 15:45
jQuery plugin to equalize height of a set of elements if you can't do so via CSS for whatever reason.
/*
Column Equalize
Example: $('.col-equalize .col').colequalize();
*/
;(function($) {
$.fn.colequalize = function(options) {
var h = 0;
@timstl
timstl / fancy_adjacent_post_link.php
Last active December 17, 2015 07:09
WordPress Fancy Adjacent Post Links. For use on regular posts or custom post type.
function fancy_adjacent_post_link($prev=false, $iter=1)
{
global $post;
$link = $title = '';
$a_post = get_adjacent_post( false, '', $prev );
if ($a_post && $a_post->ID > 0)
{
@timstl
timstl / jquery.simplenav.js
Last active December 16, 2015 16:29
jQuery Simple Navigation
;(function($){$.fn.cpnav=function(options)
{
var opts=$.extend({},$.fn.cpnav.defaults,options),
$navli=this.find('li');
if(opts.hasmenuchar!=''){
$('li:has(ul)',$navli).find("a:first").append(opts.hasmenuchar);
}
$navli.hover(function() {
@timstl
timstl / wpseo_remove_home_breadcrumb.php
Last active July 14, 2023 10:00
Remove "Home" link from Yoast WordPress SEO's breadcrumbs. Add to functions.php.
function wpseo_remove_home_breadcrumb($links)
{
if ($links[0]['url'] == get_home_url()) { array_shift($links); }
return $links;
}
add_filter('wpseo_breadcrumb_links', 'tg_remove_home_breadcrumb');