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 | |
/* | |
Plugin Name: Proceso por lotes recarga | |
Plugin URI: https://decodecms.com | |
Description: Plugin para demostración de proceso por lotes con recarga javascript | |
Version: 1.0 | |
Author: Jhon Marreros Guzmán | |
Author URI: https://decodecms.com | |
License: MIT | |
*/ |
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 // No copiar esta línea | |
// Register Custom Post Type | |
function contactos_post_type() { | |
$labels = array( | |
'name' => _x( 'Contactos', 'Post Type General Name', 'contactos_domain' ), | |
'singular_name' => _x( 'Contacto', 'Post Type Singular Name', 'contactos_domain' ), | |
'menu_name' => __( 'Contactos', 'contactos_domain' ), | |
'name_admin_bar' => __( 'Contactos', 'contactos_domain' ), |
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 // No copiar esta línea | |
function dcms_form_login_config() { | |
$redirect_login = get_home_url(); | |
$redirect_logout = get_home_url(); | |
if ( ! is_user_logged_in() ): | |
$args = array( | |
'echo' => false, | |
'redirect' => $redirect_login, |
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
/* | |
Se requiere pasar un objeto vars_table, que contenga el selector de la tabla HTML y el placeholder, por ejemplo: | |
let vars_table = { | |
"select": "table.table-data", | |
"placeholder": "Buscar empleados" | |
} | |
*/ | |
(function( $ ) { |
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
<? // no copiar esta línea | |
add_filter( 'the_content', 'dcms_list_data' ); | |
function dcms_list_data( $content ) { | |
$database_name = 'employees'; // nombre de la base de datos | |
$database_user = 'root'; | |
$database_pass = 'root'; | |
$database_server = 'localhost'; |
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
(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) { |
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 // 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 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 // 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 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('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()); |