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
<\?[^p] |
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 | |
if ( ! function_exists('clientes_post_type') ) { | |
// Register Custom Post Type | |
function clientes_post_type() { | |
$labels = array( | |
'name' => 'Clientes', | |
'singular_name' => 'Cliente', | |
'menu_name' => 'Clientes', |
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 | |
/* Casilla de verificación de privacidad después del formulario de comentarios */ | |
add_filter( 'comment_form_field_comment', 'mi_campo_de_privacidad_en_comentarios' ); | |
function mi_campo_de_privacidad_en_comentarios( $comment_field ) { | |
return $comment_field.'<label><input type="checkbox" name="privacy" value="privacy-key" class="privacyBox" aria-req="true"> Acepto la <a target="blank" href="https://ayudawp.com/legal/">política de privacidad</a></label>'; | |
} | |
//validación por javascript | |
add_action('wp_footer','valdate_privacy_comment_javascript'); | |
function valdate_privacy_comment_javascript(){ | |
if (is_single() && comments_open()){ |
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
// Aplazar JavaScripts | |
if (!(is_admin() )) { | |
function defer_parsing_of_js ( $url ) { | |
if ( FALSE === strpos( $url, '.js' ) ) return $url; | |
if ( strpos( $url, 'jquery.js' ) ) return $url; | |
// return "$url' defer "; | |
return "$url' defer onload='"; | |
} | |
add_filter( 'clean_url', 'defer_parsing_of_js', 11, 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
<select required name="provincia" class="form-control"> | |
<option value="">Elige Provincia</option> | |
<option value="Álava/Araba">Álava/Araba</option> | |
<option value="Albacete">Albacete</option> | |
<option value="Alicante">Alicante</option> | |
<option value="Almería">Almería</option> | |
<option value="Asturias">Asturias</option> | |
<option value="Ávila">Ávila</option> | |
<option value="Badajoz">Badajoz</option> | |
<option value="Baleares">Baleares</option> |
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
.grecaptcha-badge {opacity:0} |
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
:target::before { | |
content: ""; | |
display: block; | |
height: 90px; /* aquí la altura de la cabecera fija*/ | |
margin: -90px 0 0; /* altura negativa de la cabecera fija */ | |
} |
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
//Evitar la carga en todas las páginas | |
add_filter( ‘wpcf7_load_js’, ‘__return_false’ ); | |
add_filter( ‘wpcf7_load_css’, ‘__return_false’ ); | |
//Cargar solo en las que nos interesan | |
function jpd_carga_contactform7(){ | |
if ( is_page(‘contacto, inicio’) ) { | |
if ( function_exists( ‘wpcf7_enqueue_scripts’ ) ) { | |
wpcf7_enqueue_scripts(); | |
} |
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 | |
// --------------------------------- | |
// Redirección de registro (login) según el tipo (rol) de usuario. | |
// --------------------------------- | |
function jpd_custom_login_redirect($redirect_to, $request, $user) { | |
global $user; | |
if ( isset( $user->roles ) && is_array( $user->roles ) ) { | |
// Si es un usuario administrador le redirigimos al dashboard | |
if ( in_array( 'administrator', $user->roles ) ) |
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 | |
add_filter('authenticate', 'jpd_single_login_authenticate', 0, 3); | |
function jpd_single_login_authenticate($user, $username, $password) { | |
$user = get_user_by('login', $username); | |
if( isset($user->ID) ){ | |
if(isset($user->roles) && is_array($user->roles)) { |