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 //no copiar esta línea | |
add_action( 'woocommerce_cart_totals_after_shipping' , 'mostrar_mensaje_tipo_envio' ); | |
add_action( 'woocommerce_review_order_after_shipping' , 'mostrar_mensaje_tipo_envio' ); | |
function mostrar_mensaje_tipo_envio() { | |
$chosen_method = WC()->session->get( 'chosen_shipping_methods' ); | |
$chosen_method = explode(':', reset($chosen_method) ); | |
if ( $chosen_method[0] == 'local_pickup' ){ |
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
-- Cambiar valores | |
START TRANSACTION; | |
SET @prefix = 'wp_'; | |
SET @user_login = 'demo'; | |
SET @user_pass = 'demo'; | |
SET @user_email = 'demo@demo.com'; | |
SET @display_name = 'Nombre Demo'; | |
-- Actualiza tabla de usuarios |
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
-- Cambiar valores | |
SET @prefix = 'wp_'; | |
SET @id_user = 0; | |
-- Actualiza tabla de usermeta | |
SET @set_value_meta ='SET meta_value = ''a:1:{s:13:"administrator";b:1;}'' WHERE user_id ='; | |
SET @usermeta = CONCAT("UPDATE ", @prefix, "usermeta ", @set_value_meta, @id_user,' AND meta_key = "', @prefix, 'capabilities";' ); | |
PREPARE tblmeta FROM @usermeta; |
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 //obviar este línea | |
add_filter( 'the_content', 'dcms_list_data' ); | |
function dcms_list_data( $content ) { | |
$slug_page = 'frutas'; //slug de la página en donde se mostrará la tabla | |
$table_name = 'data_fruit'; // nombre de la tabla | |
if (is_page($slug_page)){ | |
global $wpdb; |
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 // Esta línea no se debe copiar | |
add_action( 'wp_print_footer_scripts', function () { | |
if (is_singular()): | |
$subtitulo = get_post_meta(get_the_ID(), 'Subtitulo', true); | |
if ( $subtitulo ): | |
?> | |
<script> | |
(function( $ ) { | |
let str = '<span class="dcms-subtitle">'; |
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 | |
if( ! function_exists('wc_get_products') ) return; | |
// definimos las variables de paginación y filtro | |
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1; | |
$ordering = WC()->query->get_catalog_ordering_args(); | |
$ordering['orderby'] = array_shift(explode(' ', $ordering['orderby'])); | |
$ordering['orderby'] = stristr($ordering['orderby'], 'price') ? 'meta_value_num' : $ordering['orderby']; | |
$products_per_page = apply_filters('loop_shop_per_page', wc_get_default_products_per_row() * wc_get_default_product_rows_per_page()); |
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 // no copiar esta línea | |
add_filter('the_content', 'dcms_related_content'); | |
function dcms_related_content( $content ){ | |
if ( ! is_single() ) return $content; | |
$post_id = get_the_ID(); |
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 // No copiar esta línea | |
// Para el detalle de producto, creación de controlo y cambio de precio | |
add_action('woocommerce_before_add_to_cart_button', 'dcms_build_select_field'); | |
function dcms_build_select_field(){ | |
global $product; | |
$options = [ |
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( $ ) { | |
const marginTop = 170; // puedes cambiar el margen | |
const currentClasses = 'current-menu-item current_page_item'; | |
if ( ! window.location.hash ){ | |
$('li').removeClass(currentClasses); | |
$('li:first-child').addClass(currentClasses); | |
} | |
$('li a[href*="#"]').click(function(event) { |