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 | |
/* | |
* Custom styles for tiny mce | |
* HT: http://alisothegeek.com/2011/05/tinymce-styles-dropdown-wordpress-visual-editor/ | |
*/ | |
add_filter( 'mce_buttons_2', 'my_mce_buttons_2' ); | |
function my_mce_buttons_2( $buttons ) { | |
array_unshift( $buttons, 'styleselect' ); |
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 | |
class custom_feed { | |
public $feed = 'custom-xml'; | |
public function __construct() { | |
add_action( 'init', array( $this, 'init' ) ); | |
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 | |
/** | |
* Switch off is_new_day() date hiding logic | |
*/ | |
add_action( 'the_post', function( $post ) { | |
global $previousday; | |
$previousday = 0; | |
} ); |
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
/* show a little arrow image */ | |
.icon-external { | |
display: inline!important; | |
float: none!important; margin: 0 0 0 4px!important; | |
vertical-align: baseline!important; | |
} |
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
// makes sure every ajax request has the 'is_ajax' parameter sent whether its using the WP ajax API or not | |
$.ajaxSetup( { | |
data: { is_ajax: 1 } | |
} ); |
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 | |
$lessc = new lessc(); | |
$lessc->registerFunction('foo', function($arg) { | |
list($type, $delimiter, $values) = $arg; | |
// $values is not flat array when using variables within arguments | |
// We cannot easily read the compiled value | |
$string = 'mod-'; | |
if ( is_array( $values ) ) { | |
foreach( $values as $value ) { |
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', 'use_alt_feed' ); | |
function use_alt_feed() { | |
if ( is_feed() && is_post_type_archive( 'my_post_type' ) ) { | |
$feed = get_default_feed(); | |
remove_action( 'do_feed_' . $feed, 'do_feed_' . $feed ); |
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 | |
/** | |
* Sets the excerpt length for the output of the next excerpt | |
* | |
* @param int $length the number of words to show | |
* | |
* @return void | |
*/ | |
function set_excerpt_length( $length = 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
<?php | |
/** | |
* Usage: | |
* Paste a gist link into a blog post or page and it will be embedded eg: | |
* https://gist.github.com/2926827 | |
* | |
* If a gist has multiple files you can select one using a url in the following format: | |
* https://gist.github.com/2926827?file=embed-gist.php | |
*/ |