Skip to content

Instantly share code, notes, and snippets.

View imfromio's full-sized avatar

Andy Johnsen imfromio

View GitHub Profile
@imfromio
imfromio / gist:c1d3f9da93e6aa49230c6d16bd18adf1
Created November 21, 2022 16:35
Find horizontal overflowing element in browser
/* add code below to Chrome inspector Console tab */
var all = document.getElementsByTagName("*"), i = 0, rect, docWidth = document.documentElement.offsetWidth;
for (; i < all.length; i++) {
rect = all[i].getBoundingClientRect();
if (rect.right > docWidth || rect.left < 0){
console.log(all[i]);
all[i].style.borderTop = '1px solid red';
}
}
[ajax_load_more post_type="goric_products" posts_per_page="15" images_loaded="true" lazy_images="true" transition="masonry" masonry_selector=".grid-item" masonry_animation="slide-up"]
<div class="alm-item<?php if (!has_post_thumbnail()) { ?> no-img<?php } ?> grid-item">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail('large', array( 'width' => 300, 'height' => 200 )); }?>
<h4><?php the_title(); ?></h4>
</a>
</div>
@imfromio
imfromio / woocommerce_bulk_update_order_status.php
Created October 9, 2019 16:23
WooCommerce - bulk update order status
$query = new WC_Order_Query( array(
'limit' => -1,
'return' => 'ids',
) );
$orders = $query->get_orders();
foreach ( $orders as $order_id ) {
$order = new WC_Order( $order_id );
if ( ! empty( $order ) ) {
$order->update_status( 'processing' );
}
@imfromio
imfromio / woocommerce_bulk_update_product_attributes.php
Last active October 2, 2019 13:53
WooCommerce - bulk update all product's attributes
<?php
// limit number of products for each run to not overburden the server
$args = array(
'limit' => 10,
'offset' => 0,
'return' => 'ids',
);
$product_ids = wc_get_products( $args );
// loop through products
foreach ( $product_ids as $product_id ) :