This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wp_scripts_update_produtos_destaque() { | |
// Argumentos para a consulta de todos os posts do CPT 'produtos' | |
$args = array( | |
'post_type' => 'produtos', | |
'post_status' => 'publish', | |
'numberposts' => -1 | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Adicionar a coluna personalizada no CPT "clubes" | |
add_filter('manage_clubes_posts_columns', 'customize_clubes_columns'); | |
function customize_clubes_columns($columns) { | |
$columns['destaque'] = __('Destaque', 'textdomain'); | |
return $columns; | |
} | |
// Preencher a coluna com um label e um botão para marcar/desmarcar o termo "destaque" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpscripts_delete_user_shortcode($atts) { | |
// Extrai os atributos | |
$atts = shortcode_atts(array( | |
'userid' => 0, | |
), $atts, 'delete_user'); | |
// Verifica se o userid foi passado e se o usuário está logado | |
if ($atts['userid'] && is_user_logged_in()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Hook para detectar a exclusão de posts | |
add_action('before_delete_post', 'wpscripts_handle_post_deletion'); | |
function wpscripts_handle_post_deletion($post_id) { | |
global $wpdb; | |
// Verifica se o post tem uma imagem destacada | |
$thumbnail_id = get_post_thumbnail_id($post_id); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USADO EM https://galeriacdsports.com.br/home/ | |
TRECHO JS/CSS | |
<script> | |
jQuery(document).ready(function() { | |
jQuery(document).on('input change', '.sn_qtd', function() { | |
var input = jQuery(this); | |
var step = parseInt(input.attr('step'), 10); | |
var value = parseInt(input.val(), 10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Script JS | |
--------------- | |
document.addEventListener('DOMContentLoaded', function () { | |
// Função para filtrar os options do select box | |
function filtrarOptionsSelectBox(termIds) { | |
// Obtem o select box pela classe (ajuste conforme necessário) | |
const selectBox = document.querySelector('.jet-select__control[name="filial"]'); | |
if (!selectBox) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Esse script serve para mostrar um menu de favoritos só quando houver itens no data store - do tipo local storage | |
Aplique a class .showinfo no item do menu | |
e coloque o código no elementor custom code all pages. | |
*/ | |
<script> | |
jQuery(document).ready(function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uso [delete_user] | |
<?php | |
function wpscripts_delete_user_shortcode($atts) { | |
// Extrai os atributos | |
$atts = shortcode_atts(array( | |
'userid' => 0, | |
), $atts, 'delete_user'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function meu_shortcode_consultar_disponibilidade() { | |
ob_start(); // Inicia a captura de saída para permitir a utilização de echo | |
?> | |
<!-- Botão para consultar disponibilidade --> | |
<button id="botao-consultar-disponibilidade" type="button">Consultar disponibilidade</button> | |
<!-- Div para exibir o resultado --> | |
<div id="resultado-consulta"></div> | |
<!-- JavaScript para manipular o clique do botão e interagir com o AJAX --> |