Skip to content

Instantly share code, notes, and snippets.

@lilumi
lilumi / onResize.js
Last active December 27, 2015 04:19
функція, що викликаєтсья після завершення ресайзу
var waitForFinalEvent = (function () {
var timers = {};
return function (callback, ms, uniqueId) {
if (!uniqueId) {
uniqueId = "Don't call this twice without a uniqueId";
}
if (timers[uniqueId]) {
clearTimeout(timers[uniqueId]);
}
timers[uniqueId] = setTimeout(callback, ms);
@lilumi
lilumi / functions.php
Last active February 16, 2017 16:19
Збірна солянка функцій для теми вордпресу
<?php
add_editor_style();
// post thumbnail support
add_theme_support( 'post-thumbnails' );
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
remove_action('wp_head', 'next_post_rel_link', 10, 0);
remove_action('wp_head', 'feed_links', 2);
@lilumi
lilumi / loop-two-col.php
Created January 17, 2014 11:50
Вивід постів в дві колонки 1 2 3 4 5 6
<?php if (have_posts()) : $i=1; ?>
<div class="wrap-box">
<?php while (have_posts()) : the_post(); ?>
<div class="half-box<?php if ($i%2 == 0) echo ' even'; ?>">
<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
</div>
<?php $i++; endwhile; ?>
</div>
<?php endif;?>
@lilumi
lilumi / loop-two-col2.php
Last active January 3, 2016 13:49
Вивід постів в дві колонки 1 4 2 5 3 6
<?php
$i = 0;
if ( have_posts() ) : while ( have_posts() ) : the_post();
if ($i == 0) echo '<div class="onleft">';
if ($i == (round($wp_query->post_count / 2))) echo '</div><div class="onright">';
the_title();
the_content();
if ($i == $wp_query->post_count) echo '</div>';
$i++;
endwhile; endif;
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', false);
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
@lilumi
lilumi / ul-li
Created June 17, 2015 18:04
UL LI with colored bulltes
ul {
list-style: none;
margin-bottom: 1em;
}
ul li {
list-style: none;
position: relative;
padding-left: 16px;
padding-bottom: 0;
<?php
/**
* Get field key for field name.
* Will return first matched acf field key for a give field name.
*
* ACF somehow requires a field key, where a sane developer would prefer a human readable field name.
* http://www.advancedcustomfields.com/resources/update_field/#field_key-vs%20field_name
*
* This function will return the field_key of a certain field.
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
// Just set the pointer-events: none CSS to the <iframe> to disable mouse scroll.
/*
<div id="gmap-holder">
<iframe width="100%" height="400" frameborder="0" style="border:0; pointer-events:none"
src="https://www.google.com/maps/embed/v1/place?q=XXX&key=YYY"></iframe>
</div>
If you want the mouse scroll to be activated when the user clicks into the map, then use the following JS code.
It will also disable the mouse scroll again, when the mouse moves out of the map.
javascript:void(function()%7Bvar i,a,s%3Ba%3Ddocument.getElementsByTagName(%27link%27)%3Bfor(i%3D0%3Bi<a.length%3Bi%2B%2B)%7Bs%3Da%5Bi%5D%3Bif(s.rel.toLowerCase().indexOf(%27stylesheet%27)>%3D0%26%26s.href) %7Bvar h%3Ds.href.replace(/(%26%7C%5C%3F)forceReload%3D%5Cd%2B/,%27%27)%3Bs.href%3Dh%2B(h.indexOf(%27%3F%27)>%3D0%3F%27%26%27:%27%3F%27)%2B%27forceReload%3D%27%2B(new Date().valueOf())%7D%7D%7D)()%3B