Skip to content

Instantly share code, notes, and snippets.

@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:38
Add body class
<body <?php body_class(); ?>>
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:38
Home link
<?php echo home_url(); ?>
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:39
Include menu
<?php wp_nav_menu( array( 'theme_location' => 'header-menu', 'menu_class' => 'nav navbar-nav' ) ); ?>
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:41
Template path
echo get_template_directory_uri();
<?php get_template_directory_uri(); ?>
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:43
Body structure
<?php get_header(); ?> // start
<?php get_footer(); ?> // end
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:44
Document ready
$(document).ready(function(){
});
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:46
Search for a word then do something
var item = $('.stanje');
for (var i = 0; i <= item.length; i++) {
if ($(item[i]).text() == 'prodano') {
$(item[i]).addClass('bg-danger');
} else if ($(item[i]).text() == 'rezervirano') {
$(item[i]).addClass('bg-warning');
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:47
Check URL and create an array
// check url
var url = window.location.pathname;
var output = url.split('/');
//alert (output[0]);
if (output[0] == "condition") {
// do something
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:48
Add or remove class
$( "#menu-item-11" ).addClass( "download" );
$( ".pages ul").removeClass( "btn btn-primary" ).addClass( "btn btn-success" );
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:49
Append or prepend
$( '.left li a' ).append( '<i class="fa fa-arrow-circle-right pull-right"></i>' );
http://api.jquery.com/append/
http://api.jquery.com/prepend/