Skip to content

Instantly share code, notes, and snippets.

<?php
/*
* Plugin Name: Feelings
* Plugin URI: trepmal.com
* Description: Add your feelings to your post
* Version: 0.1
* Author: Kailey Lampert
* Author URI: kaileylampert.com
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
function kv_recipe_permalinks( $permalink, $post ) {
if ( $post->post_type !== 'recipes' )
return $permalink;
$terms = get_the_terms( $post->ID, 'occasion' );
if ( ! $terms )
return str_replace( '%occasion%/', '', $permalink );
$post_terms = array();
//filter the <p> tags from the images and iFrame
function filter_ptags_on_images($content) {
$content = preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
return preg_replace('/<p>\s*(<span .*>)?\s*(<iframe .*>*.<\/iframe>)\s*(<\/span>)?\s*<\/p>/iU', '\1\2\3', $content);
}
add_filter('the_content', 'filter_ptags_on_images');
<?php
//Fix homepage pagination
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} else if ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
@illucent
illucent / gist:9768902
Created March 25, 2014 19:05
ul li counter last first taxonomy list
<?php if ( is_page_template('page-gallery.php') || 'album_type' == get_post_type()) : ?>
<section id="gallery_category_nav" class="widget">
<?php $taxonomy = 'album_category';
$args = array(
'orderby' => 'count',
'order' => 'DESC',
'fields' => 'all',
'hide_empty' => false,
<?php
/**
* Implements custom header styles for Child2013.
* See http://codex.wordpress.org/Custom_Headers
*
* @package WordPress
* @subpackage Twenty_Thirteen
* @since Twenty Thirteen 1.0
*/
<?php
add_filter( 'the_content', 'remove_empty_p', 20, 1 );
function remove_empty_p( $content ){
// clean up p tags around block elements
$content = preg_replace( array(
'#<p>\s*<(div|aside|section|article|header|footer)#',
'#</(div|aside|section|article|header|footer)>\s*</p>#',
'#</(div|aside|section|article|header|footer)>\s*<br ?/?>#',
'#<(div|aside|section|article|header|footer)(.*?)>\s*</p>#',
'#<p>\s*</(div|aside|section|article|header|footer)#',
// http://davidwalsh.name/lazy-load-elements
$('article pre').length && (function() {
var mediaPath = '/assets/';
$('<link>').attr({
type: 'text/css',
rel: 'stylesheet',
href: mediaPath + 'css/syntax.css'
}).appendTo(document.head);
curl -X POST -H "Content-Type: application/json" -d '{"username":"marcusoft.net@gmail.com","password":"xyz"}' http://localhost:3000/user -v
curl -X POST -H "Content-Type: application/json" -d '{"username":"hugo@gmail.com","password":"xyz^2"}' http://localhost:3000/user -v
curl -X POST -H "Content-Type: application/json" -d '{"username":"abbe@gmail.com","password":"zyx"}' http://localhost:3000/user -v