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
// source: http://bradsknutson.com/blog/highlight-search-terms-wordpress/ | |
function highlight_search_term($text){ | |
if(is_search()){ | |
$keys = implode('|', explode(' ', get_search_query())); | |
$text = preg_replace('/(' . $keys .')/iu', '<span class="search-term">\0</span>', $text); | |
} | |
return $text; | |
} | |
add_filter('the_excerpt', 'highlight_search_term'); | |
add_filter('the_title', 'highlight_search_term'); |
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
$(function() { | |
$("ul").each(function() { | |
var list = $(this); | |
var size = 3; | |
var current_size = 0; | |
list.children().each(function() { | |
console.log(current_size + ": " + $(this).text()); | |
if (++current_size > size) { | |
var new_list = $("<ul></ul>").insertAfter(list); | |
list = new_list; |
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
// source:http://www.onextrapixel.com/2012/10/12/5-code-snippets-for-interacting-with-wordpress-post-content-effectively/ | |
function auto_nofollow($content) { | |
//return stripslashes(wp_rel_nofollow($content)); | |
return preg_replace_callback('/<a>]+/', 'auto_nofollow_callback', $content); | |
} | |
add_filter('comment_text', 'auto_nofollow'); | |
function auto_nofollow_callback($matches) { | |
$link = $matches[0]; | |
$site_link = get_bloginfo('url'); | |
if (strpos($link, 'rel') === false) { |
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_action('activated_plugin','save_error'); | |
function save_error(){ | |
file_put_contents(ABSPATH. 'wp-content/error_activation.html', ob_get_contents()); | |
} |
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
$(function($) { | |
// Split Browse Archive checkboxes into vertically alphabetized Omega columns. | |
var num_cols = 3, | |
container = $('.split-list'), | |
listItem = 'li', | |
listClass = 'sub-list'; | |
// For each exposed filter that has checkboxes. | |
container.each(function() { | |
// Figure out how many elements should be in each column. | |
var items_per_col = new Array(), |
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
@font-face { | |
font-family:FontFamily; | |
src: url('relatuve/directory/to/css/font.eot'); | |
src: url('relatuve/directory/to/css/font.eot?#iefix') format('embedded-opentype'), | |
url('relatuve/directory/to/css/font.woff') format('woff'), | |
url('relatuve/directory/to/css/font.ttf') format('truetype'), | |
url('relatuve/directory/to/css/font.svg#FontFamily') format('svg'); | |
font-weight: normal; | |
font-style: normal; | |
} |
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
$us_states_and_territories = array( | |
'Alabama', | |
'Alaska', | |
'American Samoa', | |
'Arizona', | |
'Arkansas', | |
'California', | |
'Colorado', | |
'Connecticut', | |
'Delaware', |
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
$us_states = array( | |
'Alabama', | |
'Alaska', | |
'Arizona', | |
'Arkansas', | |
'California', | |
'Colorado', | |
'Connecticut', | |
'Delaware', | |
'District of Columbia', |
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
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
$query = new WP_Query(array( | |
'post_type' => 'post', | |
'no_found_rows' => true, | |
'no_found_rows' => true, // useful when pagination is not needed. | |
'update_post_meta_cache' => false, // useful when post meta will not be utilized. | |
'update_post_term_cache' => false, //useful when taxonomy terms will not be utilized. | |
'fields' => 'ids', //useful when only the post IDs are needed (less typical). | |
)); | |
if (have_posts()) : |
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
$query = new WP_Query( array( | |
'post_type' => 'post', | |
'no_found_rows' => true, | |
'no_found_rows' => true, // useful when pagination is not needed. | |
'update_post_meta_cache' => false, // useful when post meta will not be utilized. | |
'update_post_term_cache' => false, //useful when taxonomy terms will not be utilized. | |
'fields' => 'ids', //useful when only the post IDs are needed (less typical). | |
) ); | |
if( have_posts() ) : | |
while( $query->have_posts() ) : |
OlderNewer