Skip to content

Instantly share code, notes, and snippets.

@plavet
plavet / gist:2707013
Created May 16, 2012 03:10
Jquery - Open in new window using rel
//Open link in new tab
$("a[rel^='external']").click(function(){
this.target = "_blank";
});
// Usage:
// <a href="#" rel="external">#</a>
@plavet
plavet / gist:2757626
Created May 20, 2012 10:45
CSS - Image Replacment
.ir {
border:0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@plavet
plavet / gist:2771828
Created May 22, 2012 21:45
Wordpress - Custom Navigation Menus
/**
* Custom Navigation menus
*
* insert to functions.php
*/
add_action( 'init', 'my_custom_menus' );
function my_custom_menus() {
register_nav_menus(
array(
'primary-menu' => __( 'Primary Menu' ),
@plavet
plavet / gist:2772700
Created May 23, 2012 01:15
CSS - Font replace
@font-face
{
font-family: text;
src: url('../fonts/somefont.ttf'),
url('../fonts/somefont.eot') format("opentype"); /* IE */
}
@font-face
{
font-family: text;
src: url('../fonts/somefont.ttf'),
@plavet
plavet / gist:2774503
Created May 23, 2012 10:38
Wordpress - IF/ELSE
<?php if ( is_front_page() ) { ?>
<h2 class="naslov"><?php bloginfo('name'); ?></h2>
<?php } elseif ( is_page() ) { ?>
<h2 class="naslov"><?php the_title(); ?></h2>
<?php } else { ?>
<?php } ?>
/*
** http://codex.wordpress.org/Conditional_Tags
@plavet
plavet / gist:2795419
Created May 26, 2012 21:37
HTML - Simple Accordion
<h2 class="triger active"><a href="#">Header</a></h2>
<div class="armonika">
<div class="armonika-sadrzaj">
</div><!-- /armonika-sadrzaj -->
</div><!-- /armonika -->
<h2 class="triger"><a href="#">Header</a></h2>
@plavet
plavet / gist:2795425
Created May 26, 2012 21:39
Jquery - Simple Accordion
// `armonika
$('.armonika').hide();
$('.triger:first').addClass('active').next().show();
$('.triger').click(function(e){
if( $(this).next().is(':hidden') ) {
$('.triger').removeClass('active').next().slideUp();
$(this).toggleClass('active').next().slideDown();
@plavet
plavet / gist:2795431
Created May 26, 2012 21:45
CSS - Simple Accordion base style
#armonika-kutija h2 {
font-family: Georgia;
font-size: 24px;
text-align: left;
}
h2.triger {
margin: 0;
padding: 0;
}
@plavet
plavet / gist:2804801
Created May 27, 2012 11:01
WORDPRESS - Header script tag - Jquery & engine
<script src="<?php bloginfo('template_directory'); ?>/js/jquery-1.7.2.min.js"></script>
<script src="<?php bloginfo('template_directory'); ?>/js/engine.js"></script>
@plavet
plavet / gist:2805965
Created May 27, 2012 11:13
Jquery - Ready Function
$(document).ready(function() {
});