Skip to content

Instantly share code, notes, and snippets.

View jbutko's full-sized avatar

Jozef Butko jbutko

View GitHub Profile
@jbutko
jbutko / index.php
Created December 23, 2013 16:54
PHP, HTML: If else statement embedding HTML block inside
<?php if ($foo) { ?>
<div class="mydiv">Condition is true</div>
<?php } else { ?>
<div class="myotherdiv">Condition is false</div>
<?php } ?>
@jbutko
jbutko / index.php
Created December 23, 2013 22:53
PHP, WP: Display value of one specific custom field
// Be careful as the 'key' ( = name of the field) is case sensitive
<?php echo get_post_meta($post->ID, 'key', true); ?>
<?php // From http://css-tricks.com/snippets/wordpress/using-custom-fields/ ?>
@jbutko
jbutko / script.js
Last active January 1, 2016 16:09
jQuery: sccd-sk.org jQuery tweaks
$(".ruka, .ruka div").delay(1000).fadeIn(400).delay(3000);
$(".ruka div").fadeOut(200);
$(document).ready(function () {
// hand movement: 45angle to the left and then upwards
var vlavoHore = {
start: {
@jbutko
jbutko / script.js
Last active October 2, 2019 08:14
jQuery: JQuery smooth scrolling when clicking an anchor link
$('a').click(function(){
$('html, body').animate({
scrollTop: $( $.attr(this, 'href') ).offset().top
}, 500);
return false;
});
// http://stackoverflow.com/questions/7717527/jquery-smooth-scrolling-when-clicking-an-anchor-link/7717572#7717572?newreg=16ca424bc4024b21a4fcc728ea6451d5
@jbutko
jbutko / index.php
Created January 1, 2014 16:17
PHP, HTML, htaccess: Fix X-UA-Compatible validation error
<?php header('X-UA-Compatible: IE=edge,chrome=1');
// or
<IfModule mod_headers.c>
Header set X-UA-Compatible "IE=Edge,chrome=1"
# mod_headers can't match by content-type, but we don't want to send this header on *everything*...
<FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svg|svgz|ttf|vcf|webm|webp|woff|xml|xpi)$">
Header unset X-UA-Compatible
</FilesMatch>
@jbutko
jbutko / index.php
Created January 5, 2014 19:56
HTML5, WP, functions.php: HTML5 Shim in functions.php
// add ie conditional html5 shim to header
function add_ie_html5_shim () {
global $is_IE;
if ($is_IE)
echo '<!--[if lt IE 9]>';
echo '<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>';
echo '<![endif]-->';
}
add_action('wp_head', 'add_ie_html5_shim');
@jbutko
jbutko / wp-config.php
Created January 7, 2014 16:25
WP: Default theme for Multisite WP
define('WP_DEFAULT_THEME', 'theme_folder_name');
@jbutko
jbutko / command.bash
Created January 12, 2014 10:22
Gist: Install new package
npm install grunt-sass --save-dev
// From http://gruntjs.com/getting-started
@jbutko
jbutko / index.php
Created January 13, 2014 10:28
WP, functions.php: Better WordPress Minify - exclude CSS
/* BWP minify - exclude CSS */
add_filter('bwp_minify_style_ignore', 'exclude_my_css');
function exclude_my_css($excluded) {
$excluded = array('gforms_css');
return $excluded;
}
// From http://wordpress.org/support/topic/plugin-better-wordpress-minify-gravity-forms-compatibility
@jbutko
jbutko / functions.php
Created January 15, 2014 20:55
WP, functions.php: Enqueue scripts for only if LT IE 9
add_action( 'wp_head', function() {
echo '<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->';
} );
//From http://stackoverflow.com/questions/11564142/wordpress-enqueue-scripts-for-only-if-lt-ie-9