Skip to content

Instantly share code, notes, and snippets.

@kalebweb
kalebweb / cat-sing.php
Created November 11, 2015 18:05
catogory and single
add_filter('single_template', create_function(
'$the_template',
'foreach( (array) get_the_category() as $cat ) {
if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") )
return TEMPLATEPATH . "/single-{$cat->slug}.php"; }
return $the_template;' )
);
@kalebweb
kalebweb / date.cake.php
Created October 23, 2015 23:43
tratando data no cake
<?php echo date("d/m/Y", strtotime($u['Usuario']['data_nascimento'])); ?>
@kalebweb
kalebweb / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kalebweb
kalebweb / mysql.sql
Created October 10, 2014 13:33
MYSQL
// Acessando
mysql -u {mysql-user} -p {mysql-password} -h {mysql-server}
// Vendo databases
SHOW DATABASES;
// entrando no banco e vendo tabelas
USE demo;
SHOW TABLES;
@kalebweb
kalebweb / function-font.scss
Created July 27, 2014 02:55
function font
@mixin font($tipo) {
@if $tipo == light {
font-style: normal;
font-weight: 300;
}
@if $tipo == light-italic {
font-style: italic;
font-weight: 300;
}
@if $tipo == normal {
@kalebweb
kalebweb / loop-wp-page.php
Created July 27, 2014 02:11
loop-wp-page
<?php query_posts(array('showposts' => 6, 'post_parent' => 2, 'post_type' => 'page')); ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_post_thumbnail(); ?>
<h3><?php the_title(); ?></h3>
<?php endwhile; ?>
@kalebweb
kalebweb / doc.php
Created July 22, 2014 18:40
modelo de documentação
/*
* Goodlayers Google Font File
* ---------------------------------------------------------------------
* @version 1.0 ( last updated at 17/12/2011 )
* @author Goodlayers
* @link http://goodlayers.com
* @copyright Copyright (c) Goodlayers
* ---------------------------------------------------------------------
* This file is the replica of the google font array. To update new font
* lists, goto https://www.googleapis.com/webfonts/v1/webfonts?key=*****
@kalebweb
kalebweb / show-hide-jquery.html
Created July 15, 2014 00:11
show-hide-jQuery
<script>
$(document).ready(function() {
$('.acao').click(function() {
$('.acao-container').fadeToggle();
});
});
</script>
<div class="acao">
@kalebweb
kalebweb / single.category.php
Created July 14, 2014 13:18
Single post template based on category
//Gets post cat slug and looks for single-[cat slug].php and applies it
add_filter('single_template', create_function(
'$the_template',
'foreach( (array) get_the_category() as $cat ) {
if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") )
return TEMPLATEPATH . "/single-{$cat->slug}.php"; }
return $the_template;' )
);
@kalebweb
kalebweb / menuParameters.php
Created June 26, 2014 12:32
Remove LI Elements From Output of wp_nav_menu
<?php $menuParameters = array(
// @see http://css-tricks.com/snippets/wordpress/remove-li-elements-from-output-of-wp_nav_menu/
'menu' => 'Top Menu',
'container' => false,
'echo' => false,
'items_wrap' => '%3$s',
'depth' => 0);
echo strip_tags(wp_nav_menu( $menuParameters ), '<a>');