Skip to content

Instantly share code, notes, and snippets.

View flabernardez's full-sized avatar

Flavia Bernárdez Rodríguez flabernardez

View GitHub Profile
@flabernardez
flabernardez / functions.php
Created August 19, 2021 11:10
#woocommerce disable product on hover zoom effect
<?php
add_action( 'wp', 'remove_image_zoom_support', 100 );
function remove_image_zoom_support() {
remove_theme_support( 'wc-product-gallery-zoom' );
}
@flabernardez
flabernardez / functions.php
Created August 18, 2021 17:29
#woocommerce añadir producto al carrito cuando se añade otro
<?php
add_action( 'woocommerce_add_cart_item_data', function( $cart_item_data, $product_id ) {
// If added product ID is 8397 then also add product with an ID of 8452
if ( 8397 == $product_id ) {
WC()->cart->add_to_cart( 8452 );
}
}, 10, 2 );
@flabernardez
flabernardez / functions.php
Created August 16, 2021 11:09
#woocommerce finalizar sesión
<?php
add_filter('wc_session_expiring', 'so_26545001_filter_session_expiring' );
function so_26545001_filter_session_expiring($seconds) {
return 60 * 29; // 29 minutos
}
add_filter('wc_session_expiration', 'so_26545001_filter_session_expired' );
@flabernardez
flabernardez / post-query.php
Created May 28, 2021 06:41
#wordpress #php args to display only childs from a post
<?php
$args = array(
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'city-guide',
'posts_per_page' => 36,
'paged' => $paged,
'post_parent__not_in' => array(0)
);
@flabernardez
flabernardez / operations.sql
Last active May 12, 2021 20:37 — forked from carlalexander/update_db_utf8mb4.php
#wordpress #database change charset to utf8mb4
SELECT CONCAT("ALTER TABLE ", TABLE_SCHEMA, '.', TABLE_NAME,' COLLATE utf8mb4_general_ci;')
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='local' AND TABLE_TYPE = 'BASE TABLE';
@flabernardez
flabernardez / functions.php
Created May 12, 2021 09:25
#wpallimport add emojis
add_filter('wp_all_import_is_enabled_stream_filter', 'wpai_wp_all_import_is_enabled_stream_filter', 10, 1);
function wpai_wp_all_import_is_enabled_stream_filter($enable_strem_filter) {
return FALSE;
}
add_filter('wp_all_import_csv_to_xml_remove_non_ascii_characters', 'wpai_wp_all_import_csv_to_xml_remove_non_ascii_characters', 10, 1);
function wpai_wp_all_import_csv_to_xml_remove_non_ascii_characters($remove_non_ascii_characters) {
return FALSE;
}
@flabernardez
flabernardez / styles.css
Created April 28, 2021 17:56
#css block horizontal scroll bar
html, body {
max-width: 100%;
overflow-x: hidden;
}
@flabernardez
flabernardez / style.css
Created April 4, 2021 17:52
#css #grid grid responsive
.grid {
--cols: 3;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(Max(calc(100% / var(--cols, 1)), 250px), 1fr));
}
@flabernardez
flabernardez / functions.php
Created April 3, 2021 21:08
#css #wordpress remove inline styles in wp content
add_filter('the_content', function( $content ){
//--Remove all inline styles--
$content = preg_replace('/ style=("|\')(.*?)("|\')/','',$content);
return $content;
}, 20);
@flabernardez
flabernardez / style.css
Last active April 3, 2021 17:19
#css #rgpd barra de cookies
/* Barra cookies */
#moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content a.mgbutton, #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content button.mgbutton {
background-color: #dbc5b8;
font-weight: 600;
color: #4d4d4d;
border-radius: 8px;
}
#moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-close:hover i, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-left-content #moove-gdpr-menu li a, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-left-content #moove-gdpr-menu li button, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-left-content #moove-gdpr-menu li button i, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-left-content #moove-gdpr-menu li a i, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-tab-main .moove-gdpr-tab-main-content a:hover, #moove_gdpr_cookie_info_bar.moove-gdpr-dark-scheme .moove-gdpr-info-bar