Skip to content

Instantly share code, notes, and snippets.

Thiago Mendes thiagotmendes

Block or report user

Report or block thiagotmendes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View alterar-jquery.php
function jQuery3(){
$date = date("dmy");
if (!is_admin()){
wp_register_script('jquery', get_template_directory_uri()."/assets/js/jquery.min.js", false, $date);
add_action('wp_enqueue_scripts', 'jQuery3');
View contabiliza-post.php
// Verifica se não existe nenhuma função com o nome tutsup_session_start
if ( ! function_exists( 'tutsup_session_start' ) ) {
// Cria a função
function tutsup_session_start() {
// Inicia uma sessão PHP
if ( ! session_id() ) session_start();
// Executa a ação
add_action( 'init', 'tutsup_session_start' );
View ajusta_url.php
function ajusta_url_imovel($rules) {
$new_rules = array(
'imoveis/([^/]+)/([^/]+)/?$' => 'index.php?post_type=$matches[1]&$matches[1]=$matches[2]',
$rules = array_merge($new_rules,$rules);
View breadcrumb-html-yoast.html
<p id="breadcrumbs"><span xmlns:v=""><span typeof="v:Breadcrumb"><a href="//localhost:3000/" rel="v:url" property="v:title">Home</a> » <span class="breadcrumb_last">Microcity</span></span></span></p>
View muda_vr_jquery.php
function jQuery3(){
// Apenas para mudar a versão automaticamente
$date = date("dmy");
// Le a função apenas no front do site
if (!is_admin()){
// Tira o registro do Jquery que estava funcionando
// Registra o novo script
wp_register_script('jquery', "", false, $date);
thiagotmendes /
Created Apr 10, 2018 — forked from orumad/
How to install Wordpress from command line in Valet

How to install Wordpress from command line in Valet

I use Valet as my local web development environment (PHP, Laravel, Wordpress, ...)

This gist is my own recipe to install Wordpress from the command line to use it with Valet. Maybe this is useful for you too.

Install 'WP-CLI' command line tool

View get_itens_by_term.php
<div class="container">
$terms = get_terms( 'categoria-cursos', array(
'hide_empty' => false,
) );
// var_dump($terms);
View navegaçãoSuave.js
$('a[href*="#"]:not([href="#"])').click(function () {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$("#links-do-menu .active").removeClass('active');
/* if($(".navbar-collapse").hasClass("active")) {
View funcaoInsert.php
add_action('wp_ajax_insereDados', 'insereDados');
add_action('wp_ajax_nopriv_insereDados', 'insereDados' ); // aparentemente não é obrigatorio utilizar este action
function insereDados(){
echo $_POST['nome'];
View registraScript.php
add_action( 'wp_enqueue_scripts', 'registra_script' );
function registra_script(){
$version = date("ymd-Gis");
// registra o javascript
wp_enqueue_script( 'dispara-form-ajax', get_template_directory_uri() .'/caminhoDoSeuScript/disparaForm.js', array( 'jquery' ), $version, true );
// declara que a url do arquivo faz parte do (wp-admin/admin-ajax.php)
wp_localize_script( 'dispara-form-ajax', 'funcaoRegistrada', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
You can’t perform that action at this time.