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 / WP - Adicionando Informações no <header>
Last active August 16, 2017 21:38
Wordpress & Woocommerce
<?php
//Inserir Informacoes no Header - Isso você coloca no functions.php ;)
add_action( 'wp_head', 'InformacoesDoHeader', 1 );
function InformacoesDoHeader () { ?>
Aqui você coloca as informações que precisa adicionar header do seu site. Meta, Css....
<?php } ?>
@taciara
taciara / functions.php
Created May 19, 2018 22:48 — forked from douglasanro/functions.php
Create WordPress settings page For custom options
<?php
// Let’s instantiate this class in our functions.php file:
if( is_admin() ) {
require 'simple_settings_page.php';
new simple_settings_page();
}
Metódo antigo Quaery_post
<?php query_posts(array('post_type' => 'representantes', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => 2)); ?>
<section>
<?php while(have_posts()):the_post(); ?>
<?php $imagem = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); ?>
<div class="item-<?=$post->post_name;?>">
<figure style="background-image: url('<?php echo $imagem[0] ?>');"></figure>
<h4><?php the_title(); ?></h4>
<?php the_content(); ?>
@taciara
taciara / acf-repeater.php
Last active January 15, 2019 14:28
COMO INSERIR UM REPETIDOR DENTRO DE OUTRO REPETIDOR ACF
<?php //COMO INSERIR UM REPETIDOR DENTRO DE OUTRO REPETIDOR ACF ?>
<section id="case-resultados">
<div class="grid-container">
<?php if(get_field('itens_cases_resultado')): ?>
<div id="cases-results">
<?php foreach(get_field('itens_cases_resultado') as $key => $value): ?>
<div class="item">
<figure>
<img src="<?php echo $value['logo_cases_resultado']; ?>">
</figure>
@taciara
taciara / add-to-cart.php
Last active January 16, 2019 17:39
Identifica se o produto foi comprado pelo usuário, ocultando o link do botão comprar e adicionando um botão personalizado
<?php//IDENTIFICA SE JA COMPROU O PRODUTO E MUDA O BOTAO (COLOCA ISSO NO SEU FUNCTION)
function has_bought_items($meuCursoID) {
$bought = false;
// Set HERE ine the array your specific target product IDs
$prod_arr = array( $meuCursoID );
// Get all customer orders
$customer_orders = get_posts( array(
'numberposts' => -1,
@taciara
taciara / types-modelodepagina.php
Created January 30, 2019 13:47
Criar Modelo de Página no Custom Post Type com Campo Personalizado (ACF)
<?php
//ESSE CODIGO VERIFICA O VALOR DO SELECT ACF E VERIFICA SE O ARQUIVO EXISTE
$selectTheme = get_field('escolha_o_tema');
if(file_exists(get_stylesheet_directory().'/template-parts/'.$selectTheme.'.php'))
load_template(get_stylesheet_directory().'/template-parts/'.$selectTheme.'.php');
?>
@taciara
taciara / instagram.php
Created February 8, 2019 16:35
Integração Instagram
<?php PRECISO QUE TENHA:FOTO/NUMERO DE CURTIDA / NUMERO DE COMENTARIO / DESCRICAO ?>
<?php
//SHORTCODE INSTAGRAM
add_filter( 'wpis_default_shortcode_attributes', 'custom_wpis_instagram_access_token' );
function custom_wpis_instagram_access_token ( $atts ) {
$atts['token'] = '2195092261.1677ed0.f7e6b044cdc54b859d0f9413e0e404c6';
return $atts;
}
@taciara
taciara / depoimento-acf.php
Last active February 19, 2019 15:43
depoimento ACF
<?php //INSIRA ACIMA DA CHAMADA GET_HEADER ?>
<?php acf_form_head(); ?>
<?php //MOSTRAR OS CAMPO NO FRONT ?>
<?php acf_form(array(
'post_id' => 'new_post',
'field_groups' => array(3484), // ID DO SEU CAMPO PERSONALIZADO
'form' => true,
'new_post' => array(
'post_type' => 'depoimentos', //SLUG DO CUSTOM POST TYPES
@taciara
taciara / acf-multidates.php
Created February 25, 2019 19:45
Uma extensão do ACF para selecionar multiplas datas
<?php //Utilizando ACF Multi Dates Field - Uma extensão do ACF para selecionar multiplas datas ?>
<?php
setlocale (LC_ALL, 'pt_BR');
$dataArray = get_field('data_curso');
$data = end($dataArray);
$periodoCurso = array_map(function($value) use($data){
if($data == $value)
return strftime('%d de %B de %Y',strtotime($value));
return strftime('%d',strtotime($value));
@taciara
taciara / taxonomia-single.php
Created March 6, 2019 15:17
Dar echo em uma taxonomia dentro de uma página/single....
<?php // colocar isso após o if(have_posts()):the_post();
$termsAutor = get_the_terms( get_the_ID(), 'NOMEDATAXONOMIA' );
$autor = '';
if ( $termsAutor && ! is_wp_error( $termsAutor ) ) {
foreach ( $termsAutor as $term ) {
if ( 0 == $term->parent ) {
$autor = $term->name;
} else {}
}