Skip to content

Instantly share code, notes, and snippets.

View taciara's full-sized avatar
🏠
Working from home

Taciara Furtado taciara

🏠
Working from home
View GitHub Profile
@taciara
taciara / git.txt
Last active April 9, 2020 11:24
Comando básicos para o GIT
## Comandos básicos ##
git status (ver o status do git)
git add . (para subir todos)
git add nomedoaquivo.extrensao (subir arquivo especifico)
git add * .extensao (subir arquivos dessa extensao)
git add -u (deletar oq ta no status como delete)
git commit -m "O COMENTARIO" (descrever oq vc ta subindo)
git commit -a -m "O COMENTARIO" (ele pula a etapa do git add)
git diff (ele mostra oq foi alterado nos arquivos modificados, antes de ter dado um git add)
git diff --staged (ele mostra oq foi alterado nos arquivos modificados, depois de ter dado um git add, mas antes de dar um git commit)
@taciara
taciara / links.txt
Created August 5, 2019 14:42
Lista de links úteis
@taciara
taciara / urlcanonical.php
Created July 24, 2019 19:27
Problema com url canonical na paginação.
<?php
/*
Supondo que voce tenha um link de paginação parecida com http://seusite.com.br/blog/page/2
O rel = "canonical" é exibido como http://seusite.com.br/blog/page/2
Esse filtro serve para deixar o seu canical como: http://seusite.com.br/blog
Evitando assim que o google considere páginas duplicadas
*/
//URL CANONICAL (coloque isso no seu function)
function return_canon () {
@taciara
taciara / remove-category.php
Created July 19, 2019 18:02
Remover categoria da URL
//RETIRAR O /CATEGORY DA URL
add_filter('user_trailingslashit', 'remcat_function');
function remcat_function($link) {
return str_replace("/category/", "/", $link);
}
@taciara
taciara / menu-scrol.html
Created July 7, 2019 19:19
Menu Scroll para página one page com menu ativo
<link href='https://fonts.googleapis.com/css?family=Lato:100,400,700' rel='stylesheet' type='text/css'>
<style>
* {
font-family: 'Lato', sans-serif;
font-weight: 300;
transition: all .1s ease;
}
html, body {
height: 100%;
@taciara
taciara / remove-custom-post-type-slug-from-permalinks.php
Last active July 4, 2019 11:42
Remover o Slug do CPT na ulr e no Permalinks
<?php
1. Create your custom post type (unless already created). This can be done very easily by using the great, free Custom Post Type UI plugin.
2. Create a plugin for our new code to live in (yes, it could go in your theme’s functions.php file, but then it’d be lost if the theme were changed!).
?>
<?php
// PARTE 1 DO FUNCTIONS:
// 3. Filter the permalink for our custom post type so that all published posts don’t have the slug in their URLs:
//Remova o slug dos permalinks de postagem publicados. Apenas afeta nosso tipo de postagem personalizada.
function gp_remove_cpt_slug( $post_link, $post ) {
@taciara
taciara / woocommerce.php
Created June 28, 2019 00:24
Prevenir aviso “Não há metodos disponíveis” no WooCommerce para produtos sem peso.
<?php
//Para resolver isso, estou disponibilizando um pequeno snippet que, se nenhum informação de peso for passada ao plugin WooCommerce Correios, então o peso será 300 gramas. Se algum peso for informado, então este será utilizado normalmente.
add_filter( 'woocommerce_correios_shipping_args', 'fa_min_correios_weight' );
function fa_min_correios_weight( $args ) {
$args['nVlPeso'] = ! $args['nVlPeso'] ? 0.3 : $args['nVlPeso'];
return $args;
}
?>
@taciara
taciara / taxonomia-archive.php
Created June 18, 2019 18:11
Loop da taxonomia dentro de um post type
<?php //COLE ISSO EM LOOP DO POST TYPE ?>
<?php $getCats = get_terms("NOMEDATAXONOMIA", array("hide_empty" => false)); ?>
<?php foreach($getCats as $getCat): ?>
<?php // USE ESSE TRECHO APENAS SE A SUA TAXONOMIA CONTER CAMPO PARSONALIZADO
$id_Imagem = get_term_meta($getCat->term_id, 'NOMEDOCAMPOPERSONALIZADO', true);
$minhaImagem = wp_get_attachment_image_src($id_Imagem,'full');
?>
<div class="item">
<a href="<?php echo get_term_link($getCat->term_id); ?>">
<figure>
@taciara
taciara / instagram.php
Created May 27, 2019 15:12
Como inserir Instagram no site
<?php
/**
* [IMPORTANTE] COMO USAR
*
* Adicione o shortcode [instagram_photos] dentro do conteúdo de uma página
* ou use o código php do_shortcode('[instagram_photos]')
*
*
* Você pode usar o atributo "limit" para limitar o máximo de fotos que serão mostrados.
@taciara
taciara / archive.php
Created May 13, 2019 12:21
Como inserir o titulo do seu archive
<?php query_posts(array('post_type' => 'NOMEDOSEUCUSTOMPOSTTYPE')); ?>
<h1><?php post_type_archive_title(); ?></h1>
<?php wp_reset_query(); ?>