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
/* | |
Limita a seleção de opções de um Checkbox | |
Desenvolvido por: Dante Testa | |
Sugestão de Aluno: Felipe Flip | |
*/ | |
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
function limitCheckboxSelection(groupName, limit) { | |
const checkboxes = document.querySelectorAll(`input[name="${groupName}"]`); |
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> | |
function limitCheckboxSelection(CheckBoxName, hidden_limit_field) { | |
const checkboxes = document.querySelectorAll(`input[name="${CheckBoxName}"]`); | |
const hiddenField = document.querySelector(`input[name="${hidden_limit_field}"]`); | |
const limit = parseInt(hiddenField.value, 10); | |
checkboxes.forEach((checkbox) => { | |
checkbox.addEventListener('change', () => { | |
const checkedCount = document.querySelectorAll(`input[name="${CheckBoxName}"]:checked`).length; |
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 delete_user_and_posts() { | |
$user_id = get_current_user_id(); | |
$cpts_with_author = array('cpt_slug1,cpt_slug2'); | |
remove_user_and_posts($user_id, $cpts_with_author); | |
// Redireciona para a home e desloga o usuário | |
wp_logout(); | |
wp_redirect(home_url()); |
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> | |
// obter a data atual | |
var dataAtual = new Date(); | |
// adicionar 7 dias à data atual | |
var dataTrocaFotos = new Date(dataAtual.getTime() + (7 * 24 * 60 * 60 * 1000)); | |
// formatar a data no padrão Y-m-d | |
var ano = dataTrocaFotos.getFullYear(); | |
var mes = (dataTrocaFotos.getMonth() + 1 < 10 ? '0' + (dataTrocaFotos.getMonth() + 1) : dataTrocaFotos.getMonth() + 1); // o valor do mês começa em 0, então é necessário adicionar 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
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
const checkboxes = document.querySelectorAll('input[name="esteticas[]"]'); | |
const maxChecked = 5; | |
checkboxes.forEach((checkbox) => { | |
checkbox.addEventListener('change', () => { |
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
// Adiciona a coluna de imagem do autor na lista de posts do CPT Professor | |
add_filter('manage_professor_posts_columns', 'add_author_image_column'); | |
function add_author_image_column($columns) { | |
$columns['author_image'] = __('Author Image', 'text-domain'); | |
return $columns; | |
} | |
// Mostra a imagem do autor na coluna de imagem do autor da lista de posts do CPT Professor | |
add_action('manage_professor_posts_custom_column', 'show_author_image_column', 10, 2); | |
function show_author_image_column($column, $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
<?php | |
/* | |
Plugin Name: Text to HTML | |
Description: Converte um texto em HTML usando um shortcode [text_to_html field="nome_do_campo_meta"] | |
Version: 1.0 | |
Author: Dante Testa | |
*/ | |
function text_to_html_shortcode( $atts ) { | |
$atts = shortcode_atts( array( |
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 select_cct_downloads($atts) { | |
// Define o ID padrão como 2 | |
$atts = shortcode_atts( array( | |
'id' => '2' | |
), $atts ); |
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> | |
jQuery(document).ready(function(jQuery) { | |
jQuery('.select-download').on('change', function() { | |
var selectedValue = jQuery(this).val(); | |
var $parent = jQuery(this).closest('.card-download'); | |
var $downloadBtn = $parent.find('.btn-download a'); | |
if (selectedValue) { | |
$downloadBtn.attr({ | |
href: selectedValue, |
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 /* | |
SOMA VALORES DE UM CAMPO DE CPT DO USUÁRIO CORRENTE | |
PARA USAR ==> [total_cpt cpt='lancamentos' key='_valor' query='_tipo' valor='Receita'] | |
*/ | |
function soma_valores_cpt_dante_testa($atts) { | |
$user_id = get_current_user_id(); // Obtenha o ID do usuário corrente | |
// Obtenha o nome do metafield a partir dos parâmetros do shortcode |