Skip to content

Instantly share code, notes, and snippets.

View cesgarma's full-sized avatar

cesgarma

View GitHub Profile
@cesgarma
cesgarma / styles.css
Created September 29, 2023 16:44
Astra Shop products add to cart alignment
.woocommerce ul.products li .astra-shop-summary-wrap {
height: 70% !important;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.woocommerce ul.products li .astra-shop-thumbnail-wrap {
height: 30% !important;
}
.woocommerce ul.products li .astra-shop-thumbnail-wrap img {
@cesgarma
cesgarma / script.js
Created April 26, 2022 02:53
Divi mobile menu collapsable submenus with an arrow
<script >
jQuery(function($) {
$(document).ready(function() {
$("body ul.et_mobile_menu li.menu-item-has-children, body ul.et_mobile_menu li.page_item_has_children").append('<a href="#" class="mobile-toggle"></a>');
$('ul.et_mobile_menu li.menu-item-has-children .mobile-toggle, ul.et_mobile_menu li.page_item_has_children .mobile-toggle').click(function(event) {
event.preventDefault();
$(this).parent('li').toggleClass('dt-open');
$(this).parent('li').find('ul.children').first().toggleClass('visible');
$(this).parent('li').find('ul.sub-menu').first().toggleClass('visible');
});
@cesgarma
cesgarma / functions.php
Created February 1, 2022 21:43
WordPress PHP write log functionality for debugging purposes
if ( ! function_exists('write_log')) {
function write_log ( $log ) {
if ( is_array( $log ) || is_object( $log ) ) {
error_log( print_r( $log, true ) );
} else {
error_log( $log );
}
}
}
@cesgarma
cesgarma / functions.php
Created January 22, 2022 20:08
Add Facebook Pixel to Wordpress using child theme functions.php
<?php
// Begin Facebook Pixel Code
function my_facebook_pixel_code(){
?>
<!-- Your Facebook Pixel Code goes here -->
<?php
}
add_action( 'wp_head', 'my_facebook_pixel_code' );
@cesgarma
cesgarma / functions.php
Created January 22, 2022 20:05
Preview woocommerce thank you page for an order in the Woocommerce order view
<?php
/**
* Add a button to the order admin panel below the order details that opens the thank you page for that order.
*/
function action_woocommerce_admin_order_data_after_order_details( $order ) {
echo '<a href="' . $order->get_checkout_order_received_url() . '" target="_blank" class="button" style="margin-top:10px">' . __( 'Preview Thank you page', 'woocommerce' ) . '</a>';
}
add_action( 'woocommerce_admin_order_data_after_order_details', 'action_woocommerce_admin_order_data_after_order_details', 10, 1 );
@cesgarma
cesgarma / search.sh
Last active July 22, 2021 21:53
Search for PDF, remove versioninig in the filename, remove duplicated and throw the count.
find . -iname "*.pdf" | sed -E "s/\-v[0-9].[0-9].pdf//g" | sort -u | grep -E "m7|m8|m9" | wc -l
@cesgarma
cesgarma / landscape-16-9.css
Last active June 5, 2021 16:42
Explanation & Calculations How To Force Change Divi Image Aspect Ratios Most of us are familiar with image or video aspect ratios. Lots of times our devices are made to these proportions as well. The first number in the ratio is the width, and the se
/*image aspect ratio landscape 16:9*/
.pa-image-16-9 .et_pb_image_wrap {
padding-top: 56.25%;
display: block;
}
.pa-image-16-9 .et_pb_image_wrap img {
position: absolute;
height: 100%;
<style>
.divi-delayed-content {
display: none;
transition: all 400ms ease !important;
}
.divi-delayed-content.show-content {
display: block;
}
</style>
header#main-header.et-fixed-header, #main-header{
-webkit-box-shadow:none !important;
-moz-box-shadow:none !important;
box-shadow:none !important;
}
@cesgarma
cesgarma / footer.html
Last active March 24, 2022 19:11
Easily add contact information to WordPress HTML widgets in the footer.