Skip to content

Instantly share code, notes, and snippets.

{"component":{"id":63,"name":"ct_div_block","options":{"ct_id":63,"ct_parent":9,"selector":"div_block-63-62","original":{"margin-bottom":"20","globalconditions":[{"name":"ZZOXYVSBDYNAMIC","operator":0,"value":"yes","oxycode":"[oxygen ct_sign_sha256='fbb83a7bd3dbd433361a314dc52a16df0696f59fb362194bbdb69cc1aecc03d4' data='phpfunction' function='woo_field' arguments='is_on_sale' ]"}]},"nicename":"Element Sale Countdown"},"depth":6,"children":[{"id":42,"name":"ct_code_block","options":{"ct_id":42,"ct_parent":63,"selector":"code_block-42-62","original":{"code-js":"function updateTimers() {\n \n if( window.angular ) return;\n \n var now = new Date();\n var containers = document.querySelectorAll(\".x-count\");\n \n containers.forEach(function(container) {\n var future = new Date(\n container.getAttribute(\"data-count-year\"),\n parseInt(container.getAttribute(\"data-count-mo\")) - 1, // Convertir y restar 1 al mes\n parseInt(container.getAttribute(\"data-count-day\")) + 1 // Convertir y suma
@jevgen
jevgen / Woo Metas
Created April 3, 2024 06:51 — forked from hssktm/Woo Fields
Extract different woocommerce fields easily
function woo_field($property) {
$date_format = 'd - M - Y'; //Format Date
global $woocommerce, $product;
$product_id = $product->get_id();
$info = null;
switch ($property) {
case 'id': // Extracts the product ID
<?php
/*
Plugin Name: UTF8mb4-convert
Version: 1.0
*/
function update_db_to_utf8mb4() {
if ( ! isset( $_GET['update-utf8bm4'] ) ) {
return;
}
@jevgen
jevgen / WP_Query.php
Created August 19, 2022 07:49 — forked from Dimasmagadan/WP_Query.php
#WordPress query with args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
//////Author Parameters - Show posts associated with certain author.
@jevgen
jevgen / fluid-fonts-and-icons.css
Created July 10, 2021 04:31 — forked from yankiara/fluid-fonts-and-icons.css
Fluid fonts and icons in CSS
body {
--base: 20;
--scale-headings: 1.44;
--scale-mobile: 0.7;
--scale-mobile-headings: 0.4;
--scale-icons: 1.4;
--min-viewport: 480;
--max-viewport: 1600;
--max-size: var(--base);
}
@jevgen
jevgen / wp-defer-scripts.js
Created July 10, 2021 04:27 — forked from yankiara/wp-defer-scripts.js
Defer enqueued JS scripts in Wordpress
add_filter( 'script_loader_tag', 'yankiara_defer_scripts', 10, 3 );
function yankiara_defer_scripts( $tag, $handle, $src ) {
$defer = array( 'script-handle-1', 'script-handle-2', 'script-handle-3' );
if ( in_array( $handle, $defer ) )
return '<script src="' . $src . '" defer="defer" type="text/javascript"></script>' . "\n";
return $tag;
}
@jevgen
jevgen / oxygen-repeater-dynamic-query.php
Created July 10, 2021 04:25 — forked from yankiara/oxygen-repeater-dynamic-query.php
Use dynamic queries with Oxygen's repeater
/* I'll put here different examples of dynamic query for Oxygen repeater :
* - Use one of the following repeater_dynamic_query definitions
* in code block just BEFORE the repeater
* - Set the repeater custom query settings : post type, number of posts, order...
* - Add the remove_action in a code block AFTER the repeater
*/
/****************************************************************************************************
* Display related posts for any CPT with taxonomy:
@jevgen
jevgen / php-pools.md
Created November 6, 2020 21:10 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@jevgen
jevgen / perlbrew_libgcc_s.txt
Created September 10, 2020 07:26 — forked from Dreyer/perlbrew_libgcc_s.txt
[perlbrew] ld: library not found for -lgcc_s.10.4
$ cd /usr/local/lib
$ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
$ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.4.dylib
@jevgen
jevgen / force-ssl-url-scheme.php
Created August 7, 2019 14:22 — forked from webaware/force-ssl-url-scheme.php
For WordPress, force the protocol scheme to be HTTPS when is_ssl() doesn't work, e.g. on a load-balanced server where _SERVER['HTTPS'] and _SERVER['SERVER_PORT'] don't indicate that SSL is being used. NB: may not be needed now, see SSL Insecure Content Fixer and HTTP Detection: https://ssl.webaware.net.au/https-detection/
<?php
/*
Plugin Name: Force SSL URL Scheme
Plugin URI: https://gist.github.com/webaware/4688802
Description: Force the protocol scheme to be HTTPS when is_ssl() doesn't work
Version: 1.0.0
Author: WebAware
Author URI: http://webaware.com.au/
@ref: http://wordpress.org/support/topic/ssl-insecure-needs-35-compatibility