Skip to content

Instantly share code, notes, and snippets.

@AlexMcowkin
AlexMcowkin / jquery_resize_height
Last active August 29, 2015 14:16
jQuery Resize Height
function heightDetect()
{
$(".main_head").css("height", $(window).height());
};
heightDetect();
$(window).resize(function()
{
heightDetect();
@AlexMcowkin
AlexMcowkin / jquery_page_preload
Last active August 29, 2015 14:16
jQuery Page Preload
/*HTML*/
<div id="loader"><div id="loaderInner"></div></div>
/*CSS*/
#loader {
background: none repeat scroll 0 0 #ffffff;
bottom: 0;
height: 100%;
left: 0;
position: fixed;
@AlexMcowkin
AlexMcowkin / js_secure_email
Last active August 29, 2015 14:16
JS secure Email
<script type="text/javascript">
emailE = ('info' + '@' + 'site.com')
document.write('<a href="mailto:' + emailE + '" title="Контактный Email">' + emailE + '</a>')
</script>
@AlexMcowkin
AlexMcowkin / css3_hide_email
Last active August 29, 2015 14:16
hide Email with CSS3:content
/*резать картинку это долго и нудно.*/
в css:
.email-address:before {
content: "info@mail.com";
}
а в html просто добавить класс
email: <span class="email-address"></span>
@AlexMcowkin
AlexMcowkin / wp_pagination
Last active August 29, 2015 14:16
wp pagination
<?php
/*in themefile*/
<?php if (function_exists('wp_corenavi')) wp_corenavi(); ?>
?>
<?php
/*in funtion.php*/
function wp_corenavi(){
global $wp_query, $wp_rewrite;
$pages = '';
@AlexMcowkin
AlexMcowkin / wp_shortcodes_simple
Last active August 29, 2015 14:17
WP shortcodes: simple
<?php
// в посте добавить
[shortcodeName]
// в файле functions.php
function fncName()
{
//body
return $output;
@AlexMcowkin
AlexMcowkin / wp_constant_usage
Created March 13, 2015 14:45
WP constants usage
<?php
// в файле wp-config.php добавляем константу
define('MY_THEME', 'http://mysite.loc/your-url-here/')
// а уже в других файлах где нам надо указываем MY_THEME
echo '<img src="'.MY_THEME.'/link-to-0image" />';
?>
@AlexMcowkin
AlexMcowkin / css_responsive_image
Created March 13, 2015 16:45
css responsive image
<!-- style="max-width:100%;height:auto;" -->
<img src="motorcycle.jpg" alt="Motorcycle" style="max-width:100%;height:auto;" />
@AlexMcowkin
AlexMcowkin / wp_add_custom_template
Created March 16, 2015 15:28
WP add custom template
<?php /* Template Name: Form */ ?>
<?php get_header();?>
<div>
<!-- content here -->
</div>
<?php get_footer();?>
@AlexMcowkin
AlexMcowkin / enable_js_in_browser
Last active August 29, 2015 14:17
enable JS in browser
<noscript>
Для полной работы сайта необходимо, чтоб в вашем браузере был включен JavaScript.<br />
Здесь вы найдете <a href="http://www.enable-javascript.com/" target="_blank" rel="nofollow">инструкции</a> как включить
JavaScript в вашем браузере.
</noscript>
<!--[if lt IE 8]>
<p class="browserupgrade">Вы используете <strong>старую</strong> версию баузера. Пожалуйста,
<a href="http://browsehappy.com/">обновите ваш браузер</a>.</p>
<![endif]-->