Skip to content

Instantly share code, notes, and snippets.

$('img').each(function() {
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
var ieversion=new Number(RegExp.$1)
if (ieversion>=9)
if (typeof this.naturalWidth === "undefined" || this.naturalWidth === 0) {
this.src = "http://placehold.it/" + ($(this).attr('width') || this.width || $(this).naturalWidth()) + "x" + (this.naturalHeight || $(this).attr('height') || $(this).height());
}
} else {
if (!this.complete || typeof this.naturalWidth === "undefined" || this.naturalWidth === 0) {
this.src = "http://placehold.it/" + ($(this).attr('width') || this.width) + "x" + ($(this).attr('height') || $(this).height());
@mais64
mais64 / gist:ab39f3d7b1670d987754
Created March 8, 2015 12:08
Different single post template per category wordpress
First thing you have to create different single post template like
single_portfolio.php
single_news.php
single_wordpress.php
single_default.php //For default single post template for post other than above categories.
After that open your single.php file remove all code and add following code
<?php
$post = $wp_query->post;
if (in_category('portfolio')) {
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@mais64
mais64 / custom.js
Last active August 29, 2015 14:16
Preloader function
$(window).load(function() {
$(".loader_inner").fadeOut();
$(".loader").delay(400).fadeOut("slow");
});
@mais64
mais64 / heightDetect.js
Created March 1, 2015 10:47
jQuery window resize
function heightDetect() {
$(".main_head").css("height", $(window).height());
};
heightDetect();
$(window).resize(function() {
heightDetect();
@mais64
mais64 / index.html
Last active August 29, 2015 14:16
Scroll to top simple button
<a href="#" class="scrollToTop"><i class="fa fa-chevron-up fa-2x"></i></a>