This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* DETECTA SE É DISPOSITIVO MÓVEL | |
================================================== */ | |
function isMobile() { | |
return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// para retornar o slug de cada pagina | |
function the_slug($echo=true){ | |
$slug = basename(get_permalink()); | |
do_action('before_slug', $slug); | |
$slug = apply_filters('slug_filter', $slug); | |
if( $echo ) echo $slug; | |
do_action('after_slug', $slug); | |
return $slug; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Shortcode de botões | |
class short_botao { | |
function shortcode($atts, $content = null) | |
{ | |
extract(shortcode_atts(array( | |
'classe' => '', | |
'id' => '', | |
'link' => '#' | |
), $atts)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
RETIRA OS PARÁGRAFOS E <BR> NOS CONTEÚDOS DOS SHORTCODES | |
*/ | |
remove_filter( 'the_content', 'wpautop' ); | |
add_filter( 'the_content', 'wpautop' , 99); | |
add_filter( 'shortcode_unautop',100 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
CHECA SE A PAGINA É FILHA | |
*/ | |
function is_child() { | |
global $post; // if outside the loop | |
if ( is_page() && $post->post_parent ) { | |
return true; // This is a subpage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// se for um post | |
echo get_the_post_thumbnail( $post_id, 'thumbnail', array( 'class' => 'alignleft' ) ); | |
//Se for uma página | |
echo get_the_post_thumbnail( $page->ID, 'full', array( 'class' => 'img-responsive' ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php the_time('j \d\e F \d\e Y') ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Query posts de blog com paginação e com primeiro post diferenciado | |
Usado em Gamarra | |
Alan | |
*/ | |
// WP_Query arguments | |
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; | |
$args = array( | |
'post_type' => 'post', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( isset( $_POST['submitted'] ) && isset( $_POST['post_nonce_field'] ) && wp_verify_nonce( $_POST['post_nonce_field'], 'post_nonce' ) ) { | |
$postTitleError = ''; | |
if ( isset( $_POST['submitted'] ) ) { | |
if ( trim( $_POST['postTitle'] ) === '' ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> | |
<script type="text/javascript" src="jquery-1.7.1.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
$.getJSON('estados_cidades.json', function (data) { |