Skip to content

Instantly share code, notes, and snippets.

@jaredatch
jaredatch / gist:8808432
Created February 4, 2014 17:30
Display next/prev post links
<?php
/**
* Display Next/Prev link on single posts
*
* @since 1.0.0
*/
function ja_prev_next_post_nav() {
if ( is_singular( 'post' ) ) {
echo '<div class="prev-next-navigation">';
previous_post_link( '<div class="previous">Previous article: %link</div>', '%title' );
<?php
/**
* Customize "Read More" text
*
* @since 1.0.0
* @param string $link
* @return string
*/
function ja_read_more_text( $link ) {
return str_replace( '[Read more...]', 'Continue', $link );
<?php
/**
* Conditionally force layouts
*
* @since 1.0.0
* @param string $layout
* @return string
*/
function ja_force_layout( $layout ) {
if ( is_home() || is_archive() || is_singular( 'post' ) ) {
@jaredatch
jaredatch / gist:9374389
Last active August 29, 2015 13:57
Add description to WP menu output, avoids preg_replace
<?php
/**
* Add description to menu.
*
* Adjust description location as needed.
*
* @since 1.0.0
* @param string $item_output
* @param object $item
* @return string
@jaredatch
jaredatch / gist:9376268
Created March 5, 2014 20:48
Flush comments
jQuery(function($){
$('#respond #author').attr('placeholder', 'Name');
$('#respond #email').attr('placeholder', 'Email Address');
$('#respond #url').attr('placeholder', 'Website');
$('#respond #comment').attr('placeholder', 'Comment');
$('.comment-form').prepend( '<div class="comment-form-right" />' );
$('.comment-form').prepend( '<div class="comment-form-left" />' );
$('p.comment-form-author, p.comment-form-email, p.comment-form-url').appendTo( '.comment-form-left' );
$('p.comment-form-comment').appendTo( '.comment-form-right' );
var comment_height = $('.comment-form-left').height();
<?php
/**
* Replace Excerpt Ellipsis
*
* @since 1.0.0
* @param strin $content
* @return string
*/
function ja_remove_except_ellipsis( $content ) {
return str_replace( '[&hellip;]', '<a href="' . get_permalink() . '" class="continue-reading">Continue Reading→</a>', $content );
@jaredatch
jaredatch / gist:9976544
Created April 4, 2014 15:05
WebSynthesis tweaks
<?php
// Synthesis tweaks. Drop in mu-plugins.
/**
* Disable Inactive Plugins Nag on Synthesis
*
* @since 1.0.0
*/
function ea_disable_inactive_plugins_nag() {
if ( method_exists( 'Synthesis_Software_Monitor', 'inactive_plugin_notifications' ) )
@jaredatch
jaredatch / gist:10921549
Created April 16, 2014 19:07
Fancybox with small devices
jQuery(document).ready(function($){
// Small device?
var small_device = false;
if(window.innerWidth < 500 || window.innerHeight < 500 || window.outerWidth < 500 || window.outerHeight < 500) {
small_device = true;
}
// Fancybox
if(small_device == true) {
@jaredatch
jaredatch / gist:11006935
Created April 17, 2014 19:38
social widget
<?php
/**
* Core Functionality Plugin
*
* @package CoreFunctionality
* @since 1.0.0
* @copyright Copyright (c) 2014, Bill Erickson & Jared Atchison
* @license GPL-2.0+
*/
@jaredatch
jaredatch / gist:11048253
Last active August 29, 2015 14:00
Execute shortcode directly
<?php
global $shortcode_tags;
$func = $shortcode_tags['gallery'];
echo call_user_func( $func, array( 'columns' => 4 ) );