Skip to content

Instantly share code, notes, and snippets.

View utf8-to-utf8mb4.php
<?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
View WP_Query.php
<?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
View fluid-fonts-and-icons.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
View wp-defer-scripts.js
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
View oxygen-repeater-dynamic-query.php
/* 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)
View php-pools.md

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
View perlbrew_libgcc_s.txt
$ 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/
View force-ssl-url-scheme.php
<?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
@jevgen
jevgen / docker-wordpress.sh
Created August 13, 2017 14:18 — forked from tatemz/docker-wordpress.sh
A quick way to get a WordPress installation up and running with Docker
View docker-wordpress.sh
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
version: "2"
services:
my-wpdb:
@jevgen
jevgen / wp_mail.md
Created August 10, 2017 07:13 — forked from johnbillion/wp_mail.md
WordPress Emails
View wp_mail.md

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This is accurate as of WordPress 4.8, and includes some upcoming changes in WordPress 4.9.

There are a few TODOs left. Please bear with me.