Skip to content

Instantly share code, notes, and snippets.

View jbutko's full-sized avatar

Jozef Butko jbutko

View GitHub Profile
@jbutko
jbutko / header.php
Created January 15, 2014 21:51
HTML, WP, IE, IE10: Target IE10 with class
<!--[if !IE]><!--><script>
if (/*@cc_on!@*/false) {
document.documentElement.className+=' ie10';
}
</script><!--<![endif]-->
@jbutko
jbutko / style.css
Created January 15, 2014 21:53
IE, CSS: CSS Hacks IE6-IE9
#hack{
color:red; /* All browsers */
color:red !important;/* All browsers but IE6 */
_color:red; /* Only works in IE6 */
*color:red; /* IE6, IE7 */
+color:red;/* Only works in IE7*/
*+color:red; /* Only works in IE7 */
color:red\9; /* IE6, IE7, IE8, IE9 */
color:red\0; /* IE8, IE9 */
color:red\9\0;/*Only works in IE9*/
@jbutko
jbutko / .htaccess
Created January 18, 2014 20:42
htaccess: Directives to leverage browser cache
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
@jbutko
jbutko / index.php
Created January 27, 2014 13:54
WP, qTranslate: Display language switcher
<?php echo qtrans_generateLanguageSelectCode('text'); ?>
// From http://www.webcreatorbox.com/en/tutorials/qtranslate-multilingual-wordpress-plugin/
@jbutko
jbutko / functions.php
Created January 27, 2014 17:03
WP, functions.php, qTranslate: How to make qTranslate supports Custom Post Types
add_filter('post_type_link','qtrans_convertURL');//fix custom post type URL
// From http://was955.wordpress.com/2013/04/01/how-to-make-qtranslate-supports-custom-post-types/
@jbutko
jbutko / index.php
Created February 2, 2014 19:56
WP, Qtranslate: How to Get Current Language Code by Using qTranslate Plugin of WordPress
if (qtrans_getLanguage()=='en') {
// put your code here if the current language code is 'en' (English)
} elseif (qtrans_getLanguage()=='id') {
// put your code here if the current language code is 'id' (Indonesian)
}
// From http://www.openscriptsolution.com/cms/wordpress/how-to-get-current-language-code-by-using-qtranslate-plugin-of-wordpress/
@jbutko
jbutko / scripts.js
Created February 25, 2014 19:27
jQuery: Scroll to ID element
$('a[href*=#]').click(function(){
$('html, body').animate({
scrollTop: $( $.attr(this, 'href') ).offset().top
}, 700, 'linear');
return false;
});
@jbutko
jbutko / _mixins.scss
Created March 20, 2014 20:09
CSS, SASS: em mixin
/* PX to EM conversion
example: font-size: em(30);
*/
@function em($target, $context: 16) {
@return ($target / $context) * 1em;
}
@jbutko
jbutko / index.php
Created March 25, 2014 19:45
WP, CCPM: Nezobrazovanie prazdnych poli
<div class="entry-content">
<?php the_post_thumbnail(); ?>
<?php if (get_custom_field('subtitulo')):?>
<p class="evento-subtitulo"><?php print_custom_field('subtitulo'); ?></p>
<?php endif;?>
<?php if (get_custom_field('fecha_inicio')):?>
<p><strong>Fecha:</strong> <?php print_custom_field('fecha_inicio'); ?><?php echo get_custom_field('fecha_fin') ? ' hasta el '.get_custom_field('fecha_fin') :''; ?></p>
<?php endif;?>
<?php if (get_custom_field('lugar')):?>
@jbutko
jbutko / index.php
Created March 26, 2014 17:09
WP, functions.php: Add non-clickable images to post
update_option( 'image_default_link_type', 'none' );
function no_atag_on_images($content){
return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); }
add_filter('the_content', 'no_atag_on_images');
// From http://freakify.com/make-wordpress-images-non-clickable-inside-a-post/