Skip to content

Instantly share code, notes, and snippets.

View guwordpressbrasil's full-sized avatar

guwordpressbrasil

View GitHub Profile
@guwordpressbrasil
guwordpressbrasil / teste.php
Created October 15, 2013 21:10
Teste de Gist
<?php echo('hello')?>
<?php echo 'hello2';?>
Teste
<?php
echo 'Vamos lá xD';
function teste() {
return 'teste';
}
@guwordpressbrasil
guwordpressbrasil / bbt.php
Created October 16, 2013 19:01
Plugin para mudar o tema de acordo com o Browser, usado para temas mobile
<?php
/*
Plugin Name: Browser-Based Themes
Plugin URI: http://code.kuederle.com/browserbasedthemes
Description: This plugin will serve a different theme to specific browsers.
Author: Oliver Kuederle
Author URI: http://www.kuederle.com/
Version: 1.0
*/
@guwordpressbrasil
guwordpressbrasil / enqueue.js
Created November 6, 2013 17:10
Vários scripts no enqueue
function rise_load_scripts() {
wp_register_script('main', url_fresh('js/main.js',false),array('jquery'),null);
wp_register_script('tooltip', url_fresh('js/vendor/wTooltip.1.7.min.js',false),array('jquery'),null);
wp_register_script('zoom', url_fresh('js/vendor/jquery.zoom-min.js',false),array('jquery'),null);
wp_register_script('tools', url_fresh('js/vendor/jquery.tools.min.js',false),array('jquery'),null);
wp_register_script('mailcheck', url_fresh('js/vendor/mailcheck.min.js',false),array('jquery'),null);
wp_register_script('masked', url_fresh('js/vendor/jquery.maskedinput-1.3.min.js',false),array('jquery'),null);
wp_register_script('moeda', url_fresh('js/vendor/accounting.min.js',false),array('jquery'),null);
wp_register_script('conversao', url_fresh('js/vendor/money.min.js',false),array('jquery'),null);
@guwordpressbrasil
guwordpressbrasil / url_fresh.php
Created November 21, 2013 18:12
Prevenir cache de CSS
function url_fresh($url = '', $echo = true){ //http://css-tricks.com/snippets/wordpress/prevent-css-caching/
if($echo){
echo get_stylesheet_directory_uri().'/'.$url.'?r='.filemtime( get_stylesheet_directory().'/'.$url);
}else{
return get_stylesheet_directory_uri().'/'.$url.'?r='.filemtime( get_stylesheet_directory().'/'.$url);
}
}
function carrega_scripts() {
wp_register_script('bootstrap', url_fresh('js/vendor/bootstrap.min.js',false),array('jquery'),false,false);
<?php
class Cliente {
function __construct(){
add_filter('query_vars', array( $this, 'add_query_vars'));
add_filter('rewrite_rules_array', array( $this, 'add_rewrite_rules'));
add_action('template_redirect', array( $this, 'altera_status_cliente'));
}
function add_query_vars( $vars) {