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
/* Ejemplo de código que permite asignar método de desplazamiento en un menú gracias a scrollIntoView() | |
Referencia: https://developer.mozilla.org/es/docs/Web/API/Element/scrollIntoView | |
Válido para ciertos navegadores (requiere polyfill para dar soporte a otros) | |
*/ | |
/* Asignamos a una variable todos los elementos anchor que contengan la clase scrollTo */ | |
let buttons = document.querySelectorAll('a.scrollTo'); | |
/* Recorremos la lista de elementos para asignar un receptor al evento click */ | |
buttons.forEach((button) => { |
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 htmlmin = require("html-minifier"); | |
module.exports = function(eleventyConfig){ | |
eleventyConfig.setUseGitIgnore(false); | |
eleventyConfig.addWatchTarget("./_tmp/style.css"); | |
eleventyConfig.addPassthroughCopy( { "./_tmp/style.css": "./style.css" }); | |
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
/* wp_filter variable will tell */ | |
<?php global $wp_filter; | |
echo '<pre>'; | |
var_dump( $wp_filter['wp_enqueue_scripts'] ); | |
echo '</pre>'; |
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
// según solución propuesta en http://wordpress.stackexchange.com/questions/141125/allow-html-in-excerpt | |
function wpse_allowedtags() { | |
// Add custom tags to this string | |
return '<br>,<p>'; | |
} | |
if ( ! function_exists( 'wpse_custom_wp_trim_excerpt' ) ) : | |
function wpse_custom_wp_trim_excerpt($wpse_excerpt) { | |
$raw_excerpt = $wpse_excerpt; |
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 | |
// extraemos valores de la taxonomía personalizada llamada series via campo acf taxonomy | |
$serie = get_field('acf_post_taxserie'); | |
if ( $serie && ! is_wp_error( $serie) ) : | |
// sólo un elemento de la categoria, primer elemento del array | |
// extraer id | |
$serie_id= $serie[0]->term_id; | |
// nombre | |
$serie_nombre = $serie[0]->name; | |
// vinculo a la página de archivo |
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 | |
// extraemos valores de la taxonomía personalizada llamada series | |
$serie = get_the_terms( (int)$post->ID, 'series'); | |
if ( $serie && ! is_wp_error( $serie) ) : | |
// sólo un elemento de la categoria, primer elemento del array | |
// extraer id | |
$serie_id= $serie[0]->term_id; | |
// nombre | |
$serie_nombre = $serie[0]->name; | |
// vinculo a la página de archivo |
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_action( 'init', 'define_series_taxonomy' ); | |
function define_series_taxonomy() { | |
$labels = array( | |
'name' => 'Serie', | |
'singular_name' => 'Serie', | |
'search_items' => 'Buscar Series', | |
'all_items' => 'Todos los Series', | |
'parent_item' => 'Serie Superior', |
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
function add_responsive_class_content($content){ | |
$content = mb_convert_encoding($content, 'HTML-ENTITIES', "UTF-8"); | |
if (!empty($content)) { | |
$document = new DOMDocument(); | |
libxml_use_internal_errors(true); | |
$document->loadHTML(utf8_decode($content),LIBXML_HTML_NOIMPLIED); | |
$imgs = $document->getElementsByTagName('img'); | |
foreach ($imgs as $img) { |
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 $thumb_id = get_post_thumbnail_id(); | |
if ($thumb_id != 0) : // existe imagen destacada | |
$thumb_url = wp_get_attachment_image_src($thumb_id,'large', true); | |
$thumbnail_details = get_posts(array('p' => $thumb_id, 'post_type' => 'attachment')); | |
$titulo = $thumbnail_details[0]->post_title; | |
$leyenda = $thumbnail_details[0]->post_excerpt; | |
?> | |
<figure> | |
<img class="img-responsive" alt="<?= esc_attr($titulo); ?>" src="<?= esc_url($thumb_url[0]); ?>" /> |
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 | |
add_filter ('woocommerce_add_to_cart_redirect', 'woo_redirect_to_cart'); | |
function woo_redirect_to_cart() { | |
$cart_url = WC()->cart->get_cart_url(); | |
return $cart_url; | |
} |
NewerOlder