Skip to content

Instantly share code, notes, and snippets.

View timiwahalahti's full-sized avatar
💻
Working hard, as usual

Timi Wahalahti timiwahalahti

💻
Working hard, as usual
View GitHub Profile
@bfintal
bfintal / auto-block-recovery.js
Created September 29, 2021 12:54
Encountering lots of broken blocks / block errors in WordPress Gutenberg? Paste this code in your browser developer console while editing your post to recover all the blocks at once.
var recursivelyRecoverInvalidBlockList = blocks => {
const _blocks = [ ...blocks ]
let recoveryCalled = false
const recursivelyRecoverBlocks = willRecoverBlocks => {
willRecoverBlocks.forEach( _block => {
if ( isInvalid( _block ) ) {
recoveryCalled = true
const newBlock = recoverBlock( _block )
for ( const key in newBlock ) {
_block[ key ] = newBlock[ key ]
@felixarntz
felixarntz / wp-scoped-mu-plugin-loader.php
Last active August 10, 2017 10:21
WP Scoped MU Plugin Loader
<?php
/*
Plugin Name: WP Scoped MU Plugin Loader
Plugin URI: https://gist.github.com/felixarntz/9b3bed66099641a45ce437b067fea547
Description: Loads scoped MU plugins for specific sites or networks for an improved organization of those more specific tweaks.
Version: 1.0.0
Author: Felix Arntz
Author URI: https://leaves-and-love.net
License: GNU General Public License v2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
/**
* Add support for correct UTF8 orderby for post_title (äöå)
*
* @param string $orderby ordering clause for query
*
* @return string ordering clause for query
*/
add_filter('posts_orderby', function($orderby) use ($wpdb) {
if(strstr($orderby, 'post_title')) {
@TeemuSuoranta
TeemuSuoranta / kunnat.php
Created March 8, 2017 14:55
Suomen kunnat maakunnittain 2017
<?php
$municipalities_by_region = array(
'Ahvenanmaa' => array(
35 => 'Brändö',
43 => 'Eckerö',
60 => 'Finström',
62 => 'Föglö',
65 => 'Geta',
@anttiviljami
anttiviljami / response.md
Last active December 13, 2018 08:33
Innowise CMS vs. WordPress (annotoitu)

Linkki alkuperäiseen artikkeliin: http://www.innowise.fi/fi/innowise-cms-vs-wordpress/

part1

part2

part3

1)

WordPress tukee out-of-the-box useita erilaisia käyttäjäryhmiä jotka on jaettu eri rooleihin. Pääkäyttäjän rooli on tarkoitettu sivuston tekniselle ylläpitäjälle, kun taas roolien Päätoimittaja, Kirjoittaja ja Avustaja ylläpitonäkymät on karsittu vähemmän teknisille ylläpitäjille sopiviksi. WordPressin rooleilla voi myös rajoittaa eri ryhmien käyttöoikeuksia esimerkiksi antamalla Avustaja-roolin vain muokata sivuja, muttei julkaista niitä ilman Päätoimittajan tai Pääkäyttäjän lupaa.

@k1sul1
k1sul1 / request.js
Last active July 15, 2016 15:56
Handy helper function to help battle jQuery addiction. [ES6]
export function request(options = {}){
// Usage:
// request({
// url: "example.com",
// data: document.querySelector("form"), //FormData-object or form element
// method: "POST",
// headers: {key: "value"},
// success: function(response, status){},
// error: function(error, status){},
@johnbillion
johnbillion / wp_mail.md
Last active June 3, 2024 13:31
WordPress Emails

WordPress Emails

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

This documentation has moved here: https://github.com/johnbillion/wp_mail

@thomasgriffin
thomasgriffin / gist:5368d5d28da58dd19f73
Last active May 30, 2018 10:57
Prevent Gravity Forms from storing entries on a specific form.
<?php
add_action( 'gform_after_submission_5', 'tgm_io_remove_form_entry' );
/**
* Prevents Gravity Form entries from being stored in the database
* for a specific form. In this case, the form ID is 5. Change 5 in
* the hook to target your specific form ID.
*
* @global object $wpdb The WP database object.
* @param array $entry Array of entry data.
*/
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active July 6, 2024 15:54
Using Git with Subversion Mirroring for WordPress Plugin Development