Skip to content

Instantly share code, notes, and snippets.

View Umbrous's full-sized avatar

Andrey Kozurev Umbrous

  • Ukraine, Khmelnytskyi
View GitHub Profile
<img src="<?=get_the_post_thumbnail_url()?>" alt="<?=get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true);?>" title="<?=get_the_title( get_post_thumbnail_id());?>">
var options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
function success(pos) {
var crd = pos.coords;
console.log('Your current position is:');
@Umbrous
Umbrous / css
Created January 5, 2017 15:46
slick arrow template
.slick-arrow{
position: absolute;
padding: 0;
width: 33px;
height: 43px;
background-color: fade-out(#ccc, .2);
font-size: 0;
border: none;
top: 43%;
margin-top: -21px;
@Umbrous
Umbrous / Paginate Custom Post Types
Created December 4, 2016 15:34
Paginate Custom Post Types
<?php
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query('showposts=6&post_type=news'.'&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post();
?>
<!-- LOOP: Usual Post Template Stuff Here-->
@Umbrous
Umbrous / .maintenance
Created November 30, 2016 10:32
WP закрыть сайт для тех. работ
<?php
function is_user_logged_in() {
$loggedin = false;
foreach ( (array) $_COOKIE as $cookie => $value ) {
if ( stristr($cookie, 'wordpress_logged_in_') )
$loggedin = true;
}
return $loggedin;
}
if ( !stristr($_SERVER['REQUEST_URI'], '/wp-admin/') && !stristr($_SERVER['REQUEST_URI'], '/wp-login.php') && !is_user_logged_in() ) $upgrading = time();
@Umbrous
Umbrous / closest block
Last active November 24, 2016 07:25
close block
$(document).click(function(event) {
if($(window).width() < 1211){
if ($(event.target).closest('.navigation, .hamburger').length) return;
$('.navigation').hide("slow");
$hamburger.removeClass('is-active');
$body.css('overflow', 'auto');
event.stopPropagation();
}
});
@Umbrous
Umbrous / js
Last active January 19, 2017 15:28
scroll spy
// Cache selectors
var lastId,
topMenu = $("#top-menu"),
topMenuHeight = topMenu.outerHeight()+15,
// All list items
menuItems = topMenu.find("a"),
// Anchors corresponding to menu items
scrollItems = menuItems.map(function(){
var item = $($(this).attr("href"));
if (item.length) { return item; }
<title><?php bloginfo('name'); if(is_home() || is_front_page()) { echo ' - '; bloginfo('description'); } else { wp_title(); } ?></title>
$labels3 = array(
'name' => _x('Вакансии', 'post type general name', 'OK'),
'singular_name' => _x('Ваканися', 'post type singular name', 'OK'),
'add_new' => _x('Добавить вакансию', 'infobox', 'OK'),
'add_new_item' => __('Добавить новую вакансию', 'OK'),
'edit_item' => __('Редактировать вакансию', 'OK'),
'new_item' => __('Новая вакансия', 'OK'),
'view_item' => __('Смотреть вакансию', 'OK'),
'search_items' => __('Искать вакансию', 'OK'),
'not_found' => __('Вакансию не найдены', 'OK'),
// ONLY number input
$('.pop-up__transfer_points input[type="text"]').ForceNumericOnly();
//функция
jQuery.fn.ForceNumericOnly =
function()
{
return this.each(function()
{
$(this).keydown(function(e)