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 | |
// Increase memory limit temporarily | |
ini_set('memory_limit', '1G'); // Adjust as needed | |
function resizeImage($sourcePath, $maxWidth) { | |
// Get image information | |
list($width, $height, $type) = getimagesize($sourcePath); | |
// Calculate new dimensions while maintaining aspect ratio |
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 | |
// Increase memory limit temporarily | |
ini_set('memory_limit', '1G'); // Adjust as needed | |
function convertToWebp($sourcePath) { | |
// Load the source image | |
$sourceImage = imagecreatefromstring(file_get_contents($sourcePath)); | |
if ($sourceImage === false) { | |
return false; // Unsupported image type or failed to load image |
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 get_filtered_price() { | |
global $wpdb; | |
$args = wc()->query->get_main_query(); | |
$tax_query = isset( $args->tax_query->queries ) ? $args->tax_query->queries : array(); | |
$meta_query = isset( $args->query_vars['meta_query'] ) ? $args->query_vars['meta_query'] : array(); | |
foreach ( $meta_query + $tax_query as $key => $query ) { | |
if ( ! empty( $query['price_filter'] ) || ! empty( $query['rating_filter'] ) ) { |
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
/** Slider */ | |
let slideIndex = 0; | |
const slider = () => { | |
const slides = document.querySelectorAll(".ga-slides"); | |
slides.forEach( slide => slide.style.display = "none" ); | |
slideIndex++; | |
if ( slideIndex > slides.length ) { slideIndex = 1 } | |
slides[slideIndex - 1].style.display = "block"; | |
setTimeout(slider, 5000); // Change image every 2 seconds | |
} |
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
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.github.io | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
*/ |