This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
setlocale( LC_TIME, 'fr_FR' ); | |
$date = strptime( '03 juin 2015 00:00:00', '%d %B %Y %H:%M:%S' ); | |
$time = mktime( 0, 0, 0, $date['tm_mon'] + 1, $date['tm_mday'], $date['tm_year'] + 1900 ); | |
var_dump( $date, $time, date( 'Y-m-d H:i:s', $time ) ); | |
// on 5.5 returns false, 0, 1970-etc... | |
// on 5.6 returns array(), NNNNNNNNNN, 2015-06-03 00:00:00 | |
// halps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'post_thumbnail_html', function ( $html, $post_id, $post_thumbnail_id, $size, $attr ) { | |
if ( $html == '' ) { | |
$post = get_post(); | |
preg_match( '/src="([^"]+\.(?:jpe?g|png|gif))"/i', $post->post_content, $matches ); | |
if ( $matches ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// hack to make pantheon work with subdirectory multisite | |
add_action( 'wpmu_new_blog', function( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { | |
if ( defined( 'SUBDOMAIN_INSTALL' ) && ! SUBDOMAIN_INSTALL ) { | |
$abspath = untrailingslashit( ABSPATH ); | |
$subpath = $abspath . untrailingslashit( $subpath ); | |
if ( ! is_dir( $path ) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', array( 'Enqueue_HTML', 'get_instance' ) ); | |
class Enqueue_HTML { | |
public $scripts = array(); | |
protected static $instance; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Enables $in_same_cat for any taxonomy | |
add_filter( 'get_previous_post_join', 'taxonomical_prev_next', 10, 3 ); | |
add_filter( 'get_previous_post_where', 'taxonomical_prev_next', 10, 3 ); | |
add_filter( 'get_next_post_join', 'taxonomical_prev_next', 10, 3 ); | |
add_filter( 'get_next_post_where', 'taxonomical_prev_next', 10, 3 ); | |
function taxonomical_prev_next( $sql, $in_same_cat, $excluded_categories ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
Usage: | |
wp_dropdown_categories(array( | |
'walker' => new Walker_CategoryDropdownLinks, | |
'taxonomy' => 'category' | |
)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// unautop function for embed/images etc... with alignminet classes | |
add_filter( 'the_content', function( $pee ) { | |
$pee = preg_replace( '/<p>\s*((?:<a [^>]*?>)?<(img|iframe|object|embed) [^>]*?(\balign[a-z]+\b)? (?:[^>]*?)>(?:.*?<\/\2>)?(?:<\\/a>)?){1}\s*<\\/p>/sm', '<div class="media media-$2 $3">$1</div>', $pee ); | |
return $pee; | |
}, 11 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Vine oEmbed | |
Plugin URI: http://interconnectit.com | |
Description: Registers an oEmbed handler for Vine URLs | |
Version: 1.0 | |
Author: Robert O'Rourke | |
Author URI: http://interconnectit.com | |
*/ |