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
find . -type f \( -name '*.css' -o -name '*.js' -o -name '*.txt' -o -name '*.php' -o -name '*.htm' -o -name '*.html' \) -print0 | xargs -0 grep -l `printf '^\xef\xbb\xbf'` |
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 | |
// Function for registering wp_nav_menu() in 3 locations | |
add_action( 'init', 'register_navmenus' ); | |
function register_navmenus() { | |
register_nav_menus( array( | |
'Top' => __( 'Top Navigation' ), | |
'Header' => __( 'Header Navigation' ), | |
'Footer' => __( 'Footer Navigation' ), | |
) | |
); |
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
// Equal height of the blocks | |
function setEqualHeight(blocks, etalon, correction){ | |
blocks = $(blocks); | |
if ( blocks.length > 1 ) { | |
var tallest = 0; | |
blocks.each(function(){ | |
var height = $(this).outerHeight(true); | |
if (tallest < height) tallest = height; | |
}); | |
if (etalon && tallest < etalon) { |
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 | |
// Счетчик FeedBurner с кэшированием | |
function nlt_getFeedCounter($feedid='androidbar') { | |
$output = get_transient('rss_counter'); // Получаем данные из кэша | |
if ( $output === false || $output == '' ){ // Если кэш сброшен или пустой, то получаем данные | |
$twodayago = date('Y-m-d', strtotime('-2 days', time())); | |
$onedayago = date('Y-m-d', strtotime('-1 days', time())); | |
$today = date('Y-m-d'); |
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 | |
// Счетчик Twitter с кэшированием | |
function nlt_getTwitterCounter($userID='androidbar') { | |
$output = get_transient('twitter_counter'); | |
if ( $output === false || $output == '' ) { | |
$data = json_decode(@file_get_contents('http://api.twitter.com/users/' . $userID .'.json')); | |
$output = $data->followers_count; | |
set_transient( 'twitter_counter', $output, 60*10 ); | |
} |
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 | |
function getSince($start){ | |
if ( date('Y') <= $start) { | |
return $start; | |
} else { | |
return $start.'-'.date('Y'); | |
} | |
} |
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($) { | |
$(function() { | |
$('#selector').each(function(){ | |
var text = $(this).val(); | |
$(this) | |
.focusin(function(){ | |
$(this).addClass('focus'); | |
if ($(this).val() == text) $(this).val(''); | |
}) | |
.focusout(function(){ |
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
/* Вешаем событие прокрутки на все якоря (#) на странице */ | |
$('a[href^="#"]').bind('click.smoothscroll', function (e) { | |
e.preventDefault(); | |
var target = this.hash, | |
$target = $(target); | |
$('html, body').stop().animate({ | |
'scrollTop':$target.offset().top | |
}, 900, 'swing', function () { | |
window.location.hash = target; | |
}); |
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 custom_excerpt($string, $limit) { | |
$string = strip_tags($string); | |
$count = mb_strlen($string); | |
if ($count > $limit) { | |
$string = mb_substr($string, 0, mb_strpos($string, " ", $limit)).' ...'; | |
} | |
return $string; | |
} |
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 getFacebookCounter($pageID='225279994223146') { | |
$output = get_transient('facebook_counter'); | |
if ( $output === false || $output == '' ) { | |
$data = json_decode(@file_get_contents('http://graph.facebook.com/' . $pageID)); | |
$output = $data->likes; | |
set_transient( 'facebook_counter', $output, 60*10 ); | |
} | |
echo $output; | |
} |
OlderNewer