This file contains 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 | |
/** | |
* Output content with a class on the first para | |
* | |
* @param string $class Default: 'intro' | |
* @return void | |
*/ | |
function pilau_the_content_first_para_class( $class = 'intro' ) { | |
$content = apply_filters( 'the_content', get_the_content() ); |
This file contains 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
/* | |
* Carousel JavaScript | |
*/ | |
/* Trigger when DOM has loaded */ | |
jQuery( document ).ready( function( $ ) { | |
// Initialize | |
pilau_carousels.wrapper = $( '#carousels' ); |
This file contains 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 | |
preg_match( '/([A-Za-z]{1,2}[0-9]{1,2})[\s]*([0-9][A-Za-z]{2})/', 'WC1N 3XX', $matches ); |
This file contains 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: l3rady's CPT Structure Helper | |
Plugin URI: http://l3rady.com/projects/l3rady-cpt-structure-helper/ | |
Description: | |
Author: Scott Cariss | |
Version: 0.2.1 | |
Author URI: http://l3rady.com/ | |
Text Domain: sccptshelper | |
Domain Path: /languages |
This file contains 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 | |
/* | |
These days I prefer the Dynamic Widgets plugin (http://wordpress.org/extend/plugins/dynamic-widgets/), because | |
it can accommodate sophisticated widget display rules in a GUI that clients can use. However, the Widget Logic | |
plugin (http://wordpress.org/extend/plugins/widget-logic/) still has its place. This bit of code will add | |
a "Widget Logic generator" to the Widgets page, which is useful if you use this plugin and have some users | |
who aren't comfortable with writing the simple PHP. |
This file contains 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
/** | |
* Make containing elements into links | |
* | |
* jQuery, in conjunction with two CSS classes: | |
* | |
* 'make-link' - Makes containing elements into links. Add the class '.make-link-target' | |
* to the descendant anchor that is linked to the URL you want the ancestor element to | |
* link to. The JS handles making the cursor into a pointer and adds the class 'hover' | |
* to the target anchor when the ancestor is hovered. | |
* |
This file contains 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( 'nav_menu_css_class', '__return_empty_array', 10000 ); | |
add_filter( 'nav_menu_item_id', '__return_empty_array', 10000 ); |
This file contains 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 | |
/** | |
* Get menu items of nav menu attached to specified menu location | |
* | |
* @uses get_nav_menu_locations() | |
*/ | |
function pilau_get_menu_location_items( $location_slug, $max = 0 ) { | |
static $menu_locations = null; | |
if ( $menu_locations === null ) |
This file contains 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 | |
/** | |
* Store public custom post types in global variable | |
*/ | |
add_action( 'init', 'pilau_custom_post_types_var', 1 ); | |
function pilau_custom_post_types_var() { | |
global $pilau_custom_post_types; | |
$pilau_custom_post_types = get_post_types( array( | |
'public' => true, |
This file contains 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 | |
/** | |
* Fix height of embedded Flickr slideshows | |
*/ | |
add_filter( 'oembed_result', 'pilau_fix_flickr_slideshow_height', 10, 3 ); | |
function pilau_fix_flickr_slideshow_height( $html, $url, $args ) { | |
if ( strpos( $url, "flickr.com" ) !== false && substr( $url, -6 ) == "/show/" ) | |
$html = preg_replace( '/ height="([^"]+)"/', ' height="350"', $html ); | |
return $html; |