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 // Add Lightbox to Wordpress Gallery | |
add_filter( 'wp_get_attachment_link', 'prettyPhoto'); | |
function prettyPhoto ($content) { | |
$content = preg_replace("/<a/","<a rel=\"prettyPhoto[slides]\" class=\"preloader\"",$content,1); | |
return $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
/** | |
* This class removes the default excerpt metabox | |
* and adds a new box with the wysiwyg editor capability | |
* @author etessore | |
*/ | |
class TinyMceExcerptCustomization{ | |
const textdomain = ''; | |
const custom_exceprt_slug = '_custom-excerpt'; | |
var $contexts; |
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
/** | |
* Extended Walker class for use with the | |
* Twitter Bootstrap toolkit Dropdown menus in Wordpress. | |
* Edited to support n-levels submenu. | |
* @author johnmegahan https://gist.github.com/1597994, Emanuele 'Tex' Tessore https://gist.github.com/3765640 | |
*/ | |
class BootstrapNavMenuWalker extends Walker_Nav_Menu { | |
function start_lvl( &$output, $depth ) { |
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 | |
/* Add Class to first Paragraph in WordPress the_content(); | |
Source: http://webdevbits.com/wordpress/add-class-to-first-paragraph-in-wordpress-the_content/ | |
------------------------------------------------------------------------------------------- */ | |
function first_paragraph($content){ | |
if ( is_page() || ('school' == get_post_type() ) ) { | |
return preg_replace('/<p([^>]+)?>/', '<p$1>', $content, 1); | |
} else { | |
return preg_replace('/<p([^>]+)?>/', '<p$1 class="intro">', $content, 1); |
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
// Custom WordPress Login Logo | |
function login_css() { | |
wp_enqueue_style( 'login_css', get_template_directory_uri() . '/css/login.css' ); | |
} | |
add_action('login_head', 'login_css'); |
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 | |
/* Add the anchor link button back to the TinyMCE Editor in WordPress | |
--------------------------------------------------------------- */ | |
function sennza_add_more_buttons( $buttons ) { | |
$buttons[] = 'anchor'; | |
return $buttons; | |
} | |
add_filter( 'mce_buttons', 'sennza_mce_buttons' ); | |
?> |
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 | |
/* Add a default comment icon in Wordpress | |
------------------------------------ */ | |
function add_default_avatar($avatar_defaults) | |
{ | |
$icon = get_bloginfo('template_directory') . '/images/default-comment-icon.png'; | |
$avatar_defaults[$icon] = 'Custom Default'; | |
return $avatar_defaults; | |
} |
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 | |
/* Change the WordPress Default Permalinks for Pages | |
http://wpforce.com/change-wordpress-page-permalinks/ | |
------------------------------------------------- */ | |
add_action( 'init', 'custom_page_rules' ); | |
function custom_page_rules() { | |
global $wp_rewrite; | |
$wp_rewrite->page_structure = $wp_rewrite->root . 'page/%pagename%.html'; | |
} |
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 | |
/* Apply Custom CSS to Specific Browsers | |
http://wpforce.com/custom-css-specific-browsers/ | |
--------------------------------------------- */ | |
add_filter('body_class','browser_body_class'); | |
function browser_body_class($classes) { | |
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone; |
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 | |
/* Redirect to post if search results only returns one post. | |
http://blog.wpjam.com/m/redirect-to-post-if-search-results-only-returns-one-post/ | |
------------------------------------------------------------------------------ */ | |
add_action('template_redirect', 'search_redirect_post'); | |
function search_redirect_post() { | |
if (is_search()) { | |
global $wp_query; | |
if ($wp_query->post_count == 1) { |
OlderNewer