Skip to content

Instantly share code, notes, and snippets.

View theStreets93's full-sized avatar

Matej Đaković theStreets93

View GitHub Profile
@theStreets93
theStreets93 / WP_thumbnail.php
Last active November 10, 2015 10:46
Wordpress - thumbnail - size and class
<?php the_post_thumbnail('size', array('class' => 'className')); ?>
@theStreets93
theStreets93 / WP_thumbnail_placeholder.php
Last active November 10, 2015 10:46
Wordpress - thumbnail - if not set featured image get placeholder
<?php /* if no have thumbnail */
if ( has_post_thumbnail() ):
the_post_thumbnail('size', array('class' => 'yourClassForImage'));
else:
/* get your placeholder image */
endif;
?>
@theStreets93
theStreets93 / WP_if_post_type.php
Last active November 10, 2015 10:46
Wordpress - If post type
<?php /* if Your post type, get content...*/
if ( 'yourPostType' == get_post_type() ):
/* get Your content */
endif;
?>
@theStreets93
theStreets93 / WP_if_page_id.php
Last active November 10, 2015 10:46
Wordpress - If page id or home page
<?php if (is_page('page_ID_or_SLUG')): /* if wp page what you want, get content */ endif; ?>
<?php if(is_home()): /* if wp home get content */ endif; ?>
@theStreets93
theStreets93 / app.js
Last active November 24, 2015 17:08
jQuery Tab Navigation
jQuery(document).ready(function(){
tabTrigger = jQuery('.tab-trigger');
tabContent = jQuery('.tab-content');
tabTrigger.on('click', function(){
tabTrigger.removeClass('open');
jQuery(this).addClass('open');
var thisRel = jQuery(this).attr('rel');
jQuery(document).ready(function($){
jQuery( 'ul.products li.pif-has-gallery a:first-child' ).hover( function() {
jQuery( this ).find( '.wp-post-image' ).removeClass( 'fadeInDown' ).addClass( 'animated fadeOutUp' );
jQuery( this ).find( '.secondary-image' ).removeClass( 'fadeOutUp' ).addClass( 'animated fadeInDown' );
}, function() {
jQuery( this ).find( '.wp-post-image' ).removeClass( 'fadeOutUp' ).addClass( 'fadeInDown' );
jQuery( this ).find( '.secondary-image' ).removeClass( 'fadeInDown' ).addClass( 'fadeOutUp' );
});
});
@theStreets93
theStreets93 / WP_query_sample
Last active January 3, 2016 14:09
WP Query post
<?php
$args = array(
'cat' => '2',
'showpost' => 5
);
query_posts( $args );
while ( have_posts() ) : the_post();
?>
<div class="post-wrapper">
<?php the_post_thumbnail('size', array('class' => 'post-image')); ?>
@theStreets93
theStreets93 / fancySelect.js
Last active May 9, 2016 10:02
Fancy Select
var Inchoo = Inchoo || {};
/*
* @note: all credits for attribute change logic goes to:
* https://github.com/meetselva/attrchange/blob/master/attrchange.js
* http://stackoverflow.com/questions/10868104/can-you-have-a-javascript-hook-trigger-after-a-dom-elements-style-object-change
*
**/
Inchoo.fancySelect = Class.create({
@theStreets93
theStreets93 / ReviewStars.js
Last active April 4, 2016 09:45
Magento 1 - Review Stars - Prototype
document.observe('dom:loaded', function(){
$$('#product-review-table td input').each(function(el){
el.observe('click', function(ev){
var attr = el.readAttribute('value');
var tr = el.up('tr');
tr.className = "";
tr.addClassName('star_' + attr);
});
});
});
/*! Picturefill - v2.3.1 - 2015-04-09
* http://scottjehl.github.io/picturefill
* Copyright (c) 2015 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */
window.matchMedia||(window.matchMedia=function(){"use strict";var a=window.styleMedia||window.media;if(!a){var b=document.createElement("style"),c=document.getElementsByTagName("script")[0],d=null;b.type="text/css",b.id="matchmediajs-test",c.parentNode.insertBefore(b,c),d="getComputedStyle"in window&&window.getComputedStyle(b,null)||b.currentStyle,a={matchMedium:function(a){var c="@media "+a+"{ #matchmediajs-test { width: 1px; } }";return b.styleSheet?b.styleSheet.cssText=c:b.textContent=c,"1px"===d.width}}}return function(b){return{matches:a.matchMedium(b||"all"),media:b||"all"}}}()),function(a,b,c){"use strict";function d(b){"object"==typeof module&&"object"==typeof module.exports?module.exports=b:"function"==typeof define&&define.amd&&define("picturefill",function(){return b}),"object"==typeof a&&(a.picturefill=b)}function e(a)