Skip to content

Instantly share code, notes, and snippets.

View jbutko's full-sized avatar

Jozef Butko jbutko

View GitHub Profile
@jbutko
jbutko / httaccess
Created September 14, 2013 13:38
WP, server: Default Multisite httaccess file
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
@jbutko
jbutko / index.php
Created September 19, 2013 19:25
WP, qTranslate: Show image based on language
<div class="ruka">
<?php if(qtrans_getLanguage()=='SK'): ?>
<img src="<?php bloginfo('template_directory') ?>/images/ruka<?php echo get_bloginfo('language') ?>.jpg" alt="sckr logo" />
<?php endif; ?>
<?php if(qtrans_getLanguage()=='en'): ?>
<img src="<?php bloginfo('template_directory') ?>/images/ruka<?php echo get_bloginfo('language') ?>.png" alt="icgv logo" />
<?php endif; ?>
</div><!-- .ruka -->
@jbutko
jbutko / scripts.js
Created September 21, 2013 08:14
jQuery: Posuvanie objektu zaroven so skrollovanim
$(document).ready(function(){
$(window).scroll(function() {
$('form').css('top', $(this).scrollTop() + "px");
});
});
@jbutko
jbutko / index.php
Created September 24, 2013 15:48
JS, jQuery, CSS: Add no-js class to html element to CSS target no-js browsers
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)
</script>
@jbutko
jbutko / index.php
Created September 24, 2013 16:30
PHP, WP, Contact Form 7: Echo Contact Form 7 form if it is installed (if function_exists)
<?php
if (function_exists('wpcf7')) {
echo do_shortcode( '[contact-form-7 id="413" title="Contact form 1"]' );
} else {
echo "<p class='title'>Please install <a href='http://wordpress.org/plugins/contact-form-7/' rel='nofollow'>Contact Form 7</a> plugin and build some contact form. Then use your shortcode on the contact page.</p>";
}
?>
@jbutko
jbutko / style.css
Created September 26, 2013 18:43
CSS, Safari: Target only Safari browser
@media screen and (-webkit-min-device-pixel-ratio:0) {
/* Safari and Chrome */
.flex-direction-nav-featured a{
margin-top: 4%;
}
/* Safari only override */
::i-block-chrome,.flex-direction-nav-featured a{
margin-top: 5%;
}
@jbutko
jbutko / style.css
Created September 26, 2013 19:48
CSS, IE, Chrome, Browsers: Browser specific hacks
/***** Selector Hacks ******/
/* IE6 and below */
* html #uno { color: red }
/* IE7 */
*:first-child+html #dos { color: red }
/* IE7, FF, Saf, Opera */
html>body #tres { color: red }
// HTML
<div id="ajaxBusy"></div>
// CSS
#ajaxBusy {
display:none;
position: fixed;
@jbutko
jbutko / script.js
Created September 30, 2013 17:12
jQuery: Target Class/Attribute that contains string
$(this).parent('div[class*=status_]');
@jbutko
jbutko / new_gist_file
Created October 1, 2013 15:39
WP, php, CSS, functions.php: $content_width in functions.php required
if ( ! isset( $content_width ) )
$content_width = 600;
It's also recommended to add the following CSS to your theme:
.size-auto,
.size-full,
.size-large,
.size-medium,
.size-thumbnail {