View add-multiple-products-cart-url.php
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 //remover esta línea | |
function dcms_add_multiple_products_to_cart( $url = false ) { | |
if ( ! class_exists( 'WC_Form_Handler' ) || empty( $_REQUEST['add-to-cart'] ) || false === strpos( $_REQUEST['add-to-cart'], ',' ) ) { | |
return; | |
} | |
remove_action( 'wp_loaded', array( 'WC_Form_Handler', 'add_to_cart_action' ), 20 ); | |
$product_ids = explode( ',', $_REQUEST['add-to-cart'] ); |
View relations_cpt.php
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 | |
/** | |
** Class for saving relations between CPT in ACF | |
**/ | |
class RelationsCPT { | |
public function __construct() { | |
add_filter( 'acf/update_value/name=jugadores', [ $this, 'update_players_team' ], 10, 2 ); | |
add_filter( 'acf/update_value/name=equipos', [ $this, 'update_teams_player' ], 10, 2 ); |
View request-quote-woocommerce.php
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 este línea | |
add_action('woocommerce_share', 'dcms_show_request_quote_form'); | |
function dcms_show_request_quote_form(){ | |
global $product; | |
if ( isset($_GET['sent']) ){ | |
$message = $_GET['sent'] ? 'Solicitud enviada' : 'Hubo un error'; | |
echo "<p class='msg-request-quote'>$message</p>"; | |
return; |
View copy-clipboard.js
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
/* | |
Container with class: "copy" | |
copy the text after the ":" character | |
var copyImg has the img path | |
*/ | |
(function( $ ) { | |
'use strict'; | |
// Append copy image to text |
View quantity-input.php
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 | |
/** | |
* @see https://docs.woocommerce.com/document/template-structure/ | |
* @package WooCommerce\Templates | |
* @version 4.0.0 | |
*/ | |
defined( 'ABSPATH' ) || exit; | |
if ( $max_value && $min_value === $max_value ) { |
View custom-filters-woocommerce.php
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 | |
// Set query vars | |
add_filter('query_vars', 'dcms_add_query_vars'); | |
function dcms_add_query_vars($query_vars) { | |
$query_vars[] = "dcms-stock"; | |
$query_vars[] = "dcms-brand"; | |
return $query_vars; | |
} |
View sessions_wordpress.php
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( 'init', 'dcms_session_start' ); | |
function dcms_session_start() { | |
if ( ! session_id() ) { | |
session_start(); // Iniciamos la sesion | |
} | |
} | |
add_action( 'wpcf7_submit', 'dcms_action_wpcf7_submit', 10, 2 ); |
View move-variation-price.php
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 este línea | |
add_action( 'wp_footer', 'dcms_add_script_footer' ); | |
function dcms_add_script_footer() { | |
if ( ! is_product() ) return; | |
?> | |
<script> | |
jQuery(function ($) { | |
$('.variations_form').on('woocommerce_variation_has_changed', function () { |
View add-blog-slug-posts-wordpress.php
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('generate_rewrite_rules', 'dcms_posts_add_rewrite_rules'); | |
function dcms_posts_add_rewrite_rules( $wp_rewrite ){ | |
$slug = "blog"; | |
$new_rules = [ | |
$slug.'/page/([0-9]{1,})/?$' => 'index.php?post_type=post&paged='. $wp_rewrite->preg_index(1), | |
$slug.'/(.+?)/?$' => 'index.php?post_type=post&name='. $wp_rewrite->preg_index(1), | |
]; | |
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules; |
View search-custom-table-with-shortcode.php
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 | |
// ShortCode | |
add_action( 'init', 'dcms_frm_shortcode' ); | |
function dcms_frm_shortcode(){ | |
add_shortcode('search-form', 'dcms_search_form'); | |
} | |
function dcms_search_form( $atts , $content ){ | |
global $wpdb; |
NewerOlder