Skip to content

Instantly share code, notes, and snippets.

View dantetesta's full-sized avatar

DANTE TESTA dantetesta

View GitHub Profile
<script>
/*
AUTOR: DANTE TESTA
FUNÇÃO: PESQUISA CNPJ NA API RECEITA WS + CONCATENAÇÃO DE ENDEREÇO
*/
jQuery(document).ready(function($) {
var cnpj = '#cnpj';
<script>
/*
AUTOR: DANTE TESTA
FUNÇÃO: PESQUISA CEP NA API VIA CEP + CONCATENAÇÃO DE ENDEREÇO
DATA: 18/05/2023
*/
jQuery(document).ready(function($) {
/*SETUP DE CAMPOS DO FORMULÁRIO - Altere com seus seletores abaixo! */
function mostrar_anexos_de_tickets( $atts ) {
global $wpdb;
// Atributos padrões
$atts = shortcode_atts(
array(
'id' => 0,
'tipo' => 'comentarios',
), $atts, 'mostrar_anexos'
);
<?php
// Hook para agendar a remoção do usuário após o registro
add_action('jet-engine-booking/agendamento_remocao', 'agendar_remocao_usuario');
function agendar_remocao_usuario($campos) {
// Obter o objeto do usuário usando o nome de login
$usuario = get_user_by('login', $campos['codigo']);
// Agendar a remoção do usuário após 24 horas
/// PROBLEMA ///
Listing grid de um CPT.
Cada linha tem um botão EDITAR.
O botão abre JetPopup com um form dentro.
Após editar os campos não posso configurar no form uma ação de REDIRECT, pois ela faz o refresh na página e o listing volta para a primeira página.
Se a edição ocorreu lá pela página 10, olha o trabalho toda hora ter que voltar para a página onde estava antes do EDITAR.
//👉 Colocar dentro de um widget HTML na página onde o popup irá abrir
<script>
jQuery(document).ready(function( $ ){
<?php
//Registra a action do agendamento
add_action(
"jet-form-builder/custom-action/agendar_evento",
"agendamento_wp"
);
function agendamento_wp()
{
//NAME ID DO CAMPO - POST ID
###### HOW TO USE - AJAX SWITCHER #######
buy plugin here: https://plugins.dantetesta.com.br/ajaxswitcher/
TO USE =>> CPT
[ajaxswitcher metakey="_status" size="40" type="cpt"]
OU
TO USE =>> CURRENT USER
[ajaxswitcher metakey="_status" size="40" type="current_user"]
/*
################ MANUAL ####################
Parameters:
type ="current_user" or type ="author_user" this get information about a especific scope.
if you use current_user the image was returned is about current user about section.
inf you use author_user the image was returned is about user author about the post scope.
size = "150" to define the size of image/area (in pixels)
metakey = "name-meta" to define a metafield metakey slug if you have a custom metafield on user profile.
<?php
/*
Defina os slugs dos CPTs que deseja exibir a imagem do autor no admin columns
*/
$cpt_with_author_image = array('produtos', 'boletos','cliente');
function custom_admin_columns_css() {
echo '<style>