Skip to content

Instantly share code, notes, and snippets.

View jbutko's full-sized avatar

Jozef Butko jbutko

View GitHub Profile
@jbutko
jbutko / do_color_classes.php
Created May 27, 2013 18:40 — forked from rodgerthat/do_color_classes.php
WP, PHP: Add classes for every (nth) element
/************* ADDING CLASSES TO POST_CLASS **************/
// every post has a few uniquely colored elements, rather than rely on CSS nth-magic, and to keep things smooth
// and not conflict w/ trying to use jQuery nth-magic in tandem w/ the endless scroll,
// the option is to get the server to do the heavy lifting,
// ideally it would be nice to pass the array of classes to iterate thru into the filter,
/**
*
* @param $classes
* @return array
@jbutko
jbutko / index.php
Created May 26, 2013 20:52
PHP, WP: Add different class to every nth post (3rd)
<?php if (have_posts()) : ?>
<?php $c = 0;while (have_posts()) : the_post(); $c++;
if( $c == 3) {
$style = 'third';
$c = 0;
}
else $style='';
?>
<div <?php post_class($style) ?> id="post-<?php the_ID(); ?>">
@jbutko
jbutko / ie-conditional.php
Last active December 17, 2015 18:19 — forked from stevegrunwell/gist:2140325
PHP, WP, function.php: Conditional style.css register in function.php
<?php
wp_enqueue_style('ie7-fixes', get_bloginfo('template_url') . '/css/ie7.css', false, '', 'screen');
global $wp_styles;
$wp_styles->add_data('ie7-fixes', 'conditional', 'lte IE 7');
?>
alternativa:
@jbutko
jbutko / wp-ie-conditional.php
Created May 26, 2013 11:30 — forked from Pushplaybang/wp-ie-conditional.php
WP, PHP, functions.php: Enqueue HTML5 Shim
// add ie conditional html5 shim to header
function add_ie_html5_shim () {
global $is_IE;
if ($is_IE)
wp_register_script ('html5shim', "http://html5shim.googlecode.com/svn/trunk/html5.js");
wp_enqueue_script ('html5shim');
}
add_action('wp_head', 'add_ie_html5_shim');
@jbutko
jbutko / OpenWithSublimeText2.bat
Created May 22, 2013 15:56 — forked from mrchief/LICENSE.md
SUBLIME TEXT: Add "Open with Sublime Text 2" to Windows Explorer Context Menu
@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@jbutko
jbutko / gist:5598212
Created May 17, 2013 10:09
jQuery: basic implementation
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
});
</script>