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 | |
hm_rewrite_rule( array( | |
'regex' => '^reviews/([^/]+)/?', // a review category page | |
'query' => 'review_category=$matches[1]&', | |
'template' => 'review-category.php', | |
'request_callback' => function( WP $wp ) { | |
// if the review category is "laptops" then only show items in draft |
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 | |
regex // the regex pattern to match against the URL | |
query // the wp_query arguments | |
template // the template file to load for this rewrite, full path or relative to active theme | |
request_callback // callback called when the url is matched, useful for adding complex wp_query arguments | |
disable_canonical // if set to true, will disable the often pesky canonical redirect that can erosion sly run on complex queries | |
post_query_properties // list of properties to add / overwrite on the WP_Query object, useful for setting is_my_custom_page=1 style properties. | |
title_callback // called via the wp_title hook to easily set the page title | |
restrict_access // can be set to "logged_in_only" etc for private pages. |
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 | |
hm_rewrite_rule( array( | |
'regex' => '^users/([^/]+)/?', | |
'query' => 'author_name=$matches[1]&', | |
'template' => 'user-archive.php', | |
'body_class_callback' => function( $classes ) { | |
$classes[] = 'user-archive'; | |
$classes[] = 'user-' . get_query_var( 'author_name' ); |
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
### LOG TEST | |
127.0.0.1 - - [07/Nov/2012:17:47:42 +0000] "POST /?tlc_transients_request HTTP/1.0" 499 0 "-" "WordPress/3.5-alpha-21751; http://x.y" | |
**Phase 1: Completed pre-decoding. | |
full event: '127.0.0.1 - - [07/Nov/2012:17:47:42 +0000] "POST /?tlc_transients_request HTTP/1.0" 499 0 "-" "WordPress/3.5-alpha-21751; http://x.y"' | |
hostname: 'ip-10-159-10-28' | |
program_name: '(null)' |
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: Less Test | |
Version: 0.1 | |
Author: Joe Hoyle | |
*/ | |
require_once( 'wp-less/wp-less.php' ); |
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
add_filter( 'wpthumb_post_image_path', $f = function( $path ) { | |
$dir = wp_upload_dir(); | |
$num = rand( 0, 2 ); | |
$path = $dir['basedir'] . "/test$num.jpg"; | |
return $path; | |
}); | |
add_filter( 'get_attached_file', $f ); |
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
add_filter( 'excerpt_length', function() { | |
return 50; | |
} ); |
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
function jh_excerpt_length() { | |
return 50; | |
} | |
add_filter( 'excerpt_length', 'jh_excerpt_length' ); |
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
add_action( 'init', function() { | |
if ( ! function_exists( 'w4tc_cdn' ) ) | |
return; | |
add_action( 'load-post-new.php', function() { | |
add_action( 'parse_query', function( $wp ) { | |
$wp->query_vars['post_type'] = 'page'; | |
} ); |
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
function jh_plugin_init() { | |
if ( function_exists( 'w4tc_cdn' ) ) | |
add_action( 'load-post-new.php', '_jh_add_parse_query_action' ); | |
} | |
add_action( 'init', 'jh_plugin_init' ); | |
function _jh_add_parse_query_action() { | |
add_action( 'parse_query', '_jh_add_query_var_to_parse_query' ); | |
} |