This file contains 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
add_filter( 'rest_authentication_errors', 'disable_rest_api_not_logged' ); | |
function disable_rest_api_not_logged( $errors ) { | |
if( is_wp_error( $errors ) ) { | |
return $errors; | |
} | |
if( ! is_user_logged_in() ) { | |
return new WP_Error( 'no_rest_api_sorry', 'REST API not allowed', array( 'status' => 401 ) ); | |
} | |
return $errors; | |
} |
This file contains 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
// Abrir carrito tras añadir al carrito | |
var btns_anadir_producto = document.querySelectorAll('.single_add_to_cart_button') | |
btns_anadir_producto.forEach(function (btn_anadir_producto) { | |
var prevClassState = btn_anadir_producto.classList.contains('added'); | |
var observer = new MutationObserver(function(mutations) { | |
mutations.forEach(function(mutation) { | |
if(mutation.attributeName == "class"){ | |
var currentClassState = mutation.target.classList.contains('added'); | |
if(prevClassState !== currentClassState) { | |
prevClassState = currentClassState; |
This file contains 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
const botones_menu = document.querySelectorAll(".drl-menu-item"); | |
botones_menu.forEach((item) => { | |
item.addEventListener("click", () => { | |
const label_item = item.querySelector("span").textContent; | |
const text_item = label_item.replace(/\s+/g, "_"); | |
dataLayer.push({ | |
event: "custom_click", | |
event_category: "header", | |
event_action: "menu", | |
event_label: label_item, |
This file contains 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
.bloque-plegable > input + * { | |
display: none; | |
} | |
.bloque-plegable > input:checked + * { | |
display: block; | |
} | |
.bloque-plegable > input[type=checkbox] { | |
display: none; | |
} | |
.bloque-plegable > label { |
This file contains 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 | |
// Correos implicados en el sorteo | |
$correos = [ | |
"[email protected]", | |
"[email protected]", | |
"[email protected]", | |
"[email protected]", | |
"[email protected]", | |
"[email protected]" |
This file contains 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
.listado-grid{ | |
display: grid; | |
grid-template-columns: repeat(4, minmax(auto, 1fr)); | |
grid-gap: 20px; | |
} | |
.listado-block{ | |
display: block; | |
} |
This file contains 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
document.addEventListener('DOMContentLoaded', function() { | |
var bloques_ocultos = document.getElementsByClassName('bloque oculto'); | |
var bloques = document.getElementsByClassName('bloque'); | |
var numero_bloques = bloques.length - 1; | |
// Click en ver más | |
document.getElementById('ver-mas').addEventListener('click', function() { | |
if(bloques_ocultos[0]){ | |
console.log(bloques_ocultos.length); | |
bloques_ocultos[0].classList.remove('oculto'); |