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 ); |
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 () { |
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; |
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; |
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 | |
function dcms_count_text_search( $query_object ) { | |
if( $query_object->is_search() ) { | |
global $wpdb; | |
$table = $wpdb->prefix . 'text_search'; //Nombre de la tabla | |
$col_search = 'search'; //unique | |
$col_count = 'count'; |
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 //don't copy this line | |
// Show custom table data in a WordPress specific page | |
// includes pagination and search | |
add_filter( 'the_content', 'dcms_list_data' ); | |
function dcms_list_data( $content ) { | |
$slug_page = 'empleados'; //slug page where show data | |
$table_name = 'employee'; // custom table name |
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 | |
// show custom field in product page | |
function dcms_display_field() { | |
// Optional validation for specif category | |
// global $product; | |
// $categories = $product->get_category_ids(); | |
// if ( ! in_array(34, $categories )) return; |
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 | |
// The shortcode only works in WordPress front page | |
// Shortcode Creation | |
add_action( 'init', 'dcms_add_shortcode' ); | |
function dcms_add_shortcode(){ | |
add_shortcode('particles-background', 'dcms_particles_background'); | |
} |
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 | |
// Change template tabs.php estructure | |
// Copy this file to: /wp-content/TU_THEME/woocommerce/single-product/tabs/tabs.php | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
$product_tabs = apply_filters( 'woocommerce_product_tabs', array() ); |
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_thankyou', 'we_note_order_product' ); | |
function we_note_order_product( $order_id ) { | |
$order = wc_get_order( $order_id ); | |
foreach ( $order->get_items() as $item ) { | |
$sku = $item->get_product()->get_sku(); |