Skip to content

Instantly share code, notes, and snippets.

@wernersmit
wernersmit / xmlrpc-debug.php
Created April 21, 2016 10:06
Debug XMLRPC requests received by WordPress by logging request to a log file
<?php
// -- For debugging enable XML Logging for specfic site_id
function ws_debug_xml_post() {
// Only capture XMLRPC requests.
if (XMLRPC_REQUEST) {
$logline = "XML POST: ".date('Y-m-d H:i:s')." ".str_repeat('-', 30)."\n";
@UVLabs
UVLabs / woocommerce_check.php
Last active October 27, 2021 16:02
Check if WooCommerce is active on a website and output admin notice if not
<?php
// check if WooCommerce is activated
function tld_wc_check(){
if ( class_exists( 'woocommerce' ) ) {
global $tld_wc_active;
$tld_wc_active = 'yes';
} else {
@EricBusch
EricBusch / siteground-ssh-setup.md
Last active July 30, 2024 15:04
Here are instructions on setting up SSH access on SiteGround using a Mac.

Open the Terminal app on Mac.

Change directories so that you are in your user's .ssh directory. For example, my user directory is named "Eric" so I would type the following into Terminal:

cd /Users/Eric/.ssh

Now you need to generate your SSH key pairs. Enter the following command into Terminal (source 1, source 2):

ssh-keygen -t rsa

@alirezas
alirezas / fade.js
Created February 13, 2017 10:54
fadeIn & fadeOut in vanilla js
function fadeOut(el){
el.style.opacity = 1;
(function fade() {
if ((el.style.opacity -= .1) < 0) {
el.style.display = "none";
} else {
requestAnimationFrame(fade);
}
})();
@vincentriemer
vincentriemer / twitter_encode.sh
Created May 5, 2019 02:08
Script to encode videos optimized for Twitter with ffmpeg. NOTE: Read through the entire script before running and modify to your needs, as it is currently configured for my own environment
#!/usr/bin/env bash
set -e
# usage:
# $ ./encode.sh [INPUT_FILE]
#
# NOTE: The output directory is defined in the script (below) because I use this script with Hazel
# START CONFIGURATION ==================
@nylen
nylen / README.md
Last active December 20, 2021 09:05
Fix MySQL errors with WordPress + DigitalOcean managed MySQL

When running WordPress or ClassicPress using a DigitalOcean managed MySQL database you may experience errors like the following:

Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'dbname.wp_posts.post_date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by for query SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/themename/404.php'), the_widget, WP_Widget_Archives->widget, wp_get_archives

>Expression #1 of ORDER BY clause is not in SELECT list, references column 'dbname.wp_posts.post_date' which is not in SELECT list; this is incompatible with DISTINCT fo

@aliboy08
aliboy08 / functions.php
Created March 5, 2020 06:07
Woocommerce - Single Product Carousel
// Modify single product images: add carousel functionality
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
add_action( 'woocommerce_before_single_product_summary', function(){
global $product;
$image_ids = [];
// featured image
if( has_post_thumbnail() ) $image_ids[] = get_post_thumbnail_id();
@Mitra-88
Mitra-88 / compile-aseprite-gnu-linux.md
Last active March 15, 2025 12:44 — forked from veganaize/Aseprite-build-linux.md
Compile Aseprite from source code for GNU/Linux