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 / sheets-localStorage.html
Created August 17, 2023 18:11
enviar os dados do localStorage para uma planilha do Google
Para enviar os dados do localStorage para uma planilha do Google, você precisará criar uma integração usando a API do Google Sheets. A seguir, descrevo os passos básicos para realizar essa tarefa:
Crie uma Planilha do Google:
Abra o Google Drive.
Clique no botão "Novo" e selecione "Google Planilhas" para criar uma nova planilha.
Nomeie a planilha e adicione as colunas correspondentes aos dados que você deseja armazenar.
Crie um Projeto na Google Cloud Platform:
Acesse a Google Cloud Platform Console.
@taciara
taciara / functions.php
Created August 16, 2023 17:11
Adicionar ou remover automaticamente produtos da categoria "promoções" com base no preço promocional
<?php
// Adicionar ou remover automaticamente produtos da categoria "promoções" com base no preço promocional
function update_promotion_category_based_on_sale() {
$promo_category = get_term_by('slug', 'promocoes', 'product_cat'); // Substitua 'promocoes' pela slug da categoria "promoções"
if (!$promo_category) {
return;
}
$args = array(
@taciara
taciara / code.php
Created October 27, 2022 19:25 — forked from luizbills/code.php
Copy custom terms when duplicatin a woocommerce product
<?php
// credits: https://github.com/woocommerce/woocommerce/issues/17487#issuecomment-565433819
add_action( 'woocommerce_product_duplicate', function ( $duplicate, $product ) {
$taxonomies = [ 'taxonomy1', 'taxonomy2' ];
foreach ( $taxonomies as $taxonomy ) {
$terms = get_the_terms( $product->get_id(), $taxonomy );
if ( ! is_wp_error( $terms ) ) {
wp_set_object_terms( $duplicate->get_id(), wp_list_pluck( $terms, 'term_id' ), $taxonomy );
}
@taciara
taciara / code.php
Last active October 25, 2022 17:29
How to search in ACF’s Custom Fields in WordPress (Como pesquisar nos campos personalizados do ACF no WordPress)
<?php
/**
* Crie um arquivo chamado admin_search_custom_fields.php no diretorio /includes/
* E add o COD abaixo.
*
* Extend WordPress search to include custom fields
* https://taciara.com.br
*
* Join posts and postmeta tables
* http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_join
@taciara
taciara / code.php
Created October 18, 2022 22:33
accordion into acf to page single products
<?php
/**
* @author Taciara Furtado <contato@taciara.com.br>
* @version 1.0.0
*/
add_action( 'woocommerce_after_single_product', 'site_add_accordion_products', 55 );
function site_add_accordion_products () {
global $product;?>
@taciara
taciara / page.php
Last active May 5, 2022 13:47
Puxar as páginas filha da página atual. Mas se não tiver filhas, puxar as irmãs.
<?php
$args = array(
'post_type' => 'page',
'posts_per_page' => -1,
//'post_parent' => $post->ID,
'post_parent' => $post->post_parent,
'order' => 'ASC',
'orderby' => 'title'
);
@taciara
taciara / wp-chosen-tax-metabox.php
Created April 24, 2022 02:25 — forked from helen/wp-chosen-tax-metabox.php
Use Chosen for a replacement WordPress taxonomy metabox
<?php
/**
* WordPress Chosen Taxonomy Metabox
* Author: Helen Hou-Sandi
*
* Use Chosen for a replacement taxonomy metabox in WordPress
* Useful for taxonomies that aren't changed much on the fly and are
* non-hierarchical in nature, as Chosen is for flat selection only.
* You can always use the taxonomy admin screen to add/edit taxonomy terms.
* Categories need slightly different treatment from the rest in order to
@taciara
taciara / functions.php
Created March 28, 2022 16:31
Habilitar SVG no wordpress. Cole isso no seu functions.
<?php
// ############### ACEITAR SVG NO WORDPRESS ###############
function bodhi_svgs_upload_mimes( $mimes = array() ) {
if ( current_user_can( 'administrator' ) ) {
// allow SVG file upload
$mimes['svg'] = 'image/svg+xml';
$mimes['svgz'] = 'image/svg+xml';
return $mimes;
} else {
return $mimes;
<?php
// SHOTCODE ACCORDION DINAMICO NA PAGINA
add_shortcode('accordion', 'dwm_accordion');
function dwm_accordion($atts) { ?>
<?php ob_start(); ?>
<div class="accordion-page">
@taciara
taciara / jquery.fullPage.js
Created March 22, 2021 13:12 — forked from jtmalinowski/jquery.fullPage.js
jquery.fullPage.js with horizontal wheel-scrolling, it has some other changes too, so diff against original one to see what has changed
/**
* fullPage 2.0.9
* https://github.com/alvarotrigo/fullPage.js
* MIT licensed
*
* Copyright (C) 2013 alvarotrigo.com - A project by Alvaro Trigo
*/
(function($) {
$.fn.fullpage = function(options) {