Skip to content

Instantly share code, notes, and snippets.

View dantetesta's full-sized avatar

DANTE TESTA dantetesta

View GitHub Profile
<?php
function custom_products_rewrite_rule() {
add_rewrite_rule(
'^produtos/([^/]+)/([^/]+)/?$',
'index.php?post_type=produtos&categoria=$matches[1]&name=$matches[2]',
'top'
);
}
/*MOTRA OS ANEXOS DOS TICKETS*/
function mostrar_anexos_de_tickets( $atts ) {
global $wpdb;
// Atributos padrões
$atts = shortcode_atts(
array(
'id' => 0,
'tipo' => 'comentarios',
), $atts, 'mostrar_anexos'
<script>
/*
AUTOR: DANTE TESTA
FUNÇÃO: PESQUISA CNPJ Receita WS + CEP na API VIA CEP + CONCATENAÇÃO DE ENDEREÇO
*/
jQuery(document).ready(function($) {
var cnpj = '#cnpj';
var situacao = '#situacao';
<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