Skip to content

Instantly share code, notes, and snippets.

View ooksanen's full-sized avatar

Oskari Oksanen ooksanen

View GitHub Profile
@ooksanen
ooksanen / functions.php
Last active May 12, 2019 12:15
Remove Sites -> Add New menu item from WP Multisite Network Admin
add_action( 'network_admin_menu', function () {
remove_submenu_page( 'sites.php', 'site-new.php' );
});
@ooksanen
ooksanen / tinymce-shortcodes-button.js
Created March 13, 2020 14:27
WP TinyMCE Shortcode Button Plugin
(function() {
tinymce.PluginManager.add('oo_tmce_button', function( editor, url ) {
editor.addButton( 'oo_tmce_button', {
title: 'Shortcodes',
type: 'menubutton',
icon: 'wp_code',
menu: [
{
text: 'Button',
onclick: function() {
@ooksanen
ooksanen / extra-user-data.php
Created March 13, 2020 14:31
WP Extra User Fields Plugin
<?php
/**
* Plugin Name: Extra user data
* Description: Show extra user fields in admin
* Version: 1.0
* Author: Oskari Oksanen
* Author URI: http://oskarioksanen.fi/
*/
@ooksanen
ooksanen / gutenberg-default-blocks.txt
Last active April 6, 2020 13:55
All Gutenberg default blocks listed
// These need to be enabled to save reusable blocks and templates
'core/block',
'core/template',
// Common blocks
'core/paragraph',
'core/image',
'core/heading',
'core/subhead', // DEPRECATED Subheading
'core/gallery',
@ooksanen
ooksanen / programmatically-add-gravity-forms.php
Last active April 21, 2022 13:59 — forked from daankortenbach/programmatically-add-gravity-forms.php
Updated for Gravity Forms 2.6 which requires button parameter for submit to work
<?php
/*
Plugin Name: Programmatically add Gravity Forms
Plugin URI: https://daan.kortenba.ch/programmatically-add-gravity-forms/
Description: Programmatically add persistent Gravity Forms forms.
Author: Daan Kortenbach
Version: 0.1
Author URI: https://daan.kortenba.ch/
License: GPLv2 or later
*/
@ooksanen
ooksanen / uBlacklist.txt
Last active October 13, 2022 08:46
uBlacklist site list for developers. Useful for blocking scraped / translated Stack Overflow clones etc. from Google search results.
*://*try2explore.com/*
*://*16892.net/*
*://*1r1g.com/*
*://*55276.net/*
*://*5axxw.com/*
*://*711web.com/*
*://*900913.ru/*
*://*9ishenzhen.com/*
*://*a-scrip.org/*
*://*acnenomor.com/*
@ooksanen
ooksanen / local-dev.php
Created September 14, 2023 09:34 — forked from richaber/local-dev.php
MU plugin to enable/disable other plugins during local development.
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/**
* Plugin Name: RA Local Dev Plugin
* Description: Install as an mu-plugin to enable and disable other plugins during local development.
* Version: 0.1.0
* License: GPL version 2 or any later version
* Author: Mark Jaquith, Andrey Savchenko, Paul Biron, Richard Aber
*
* Inspired by Paul Biron https://gist.github.com/pbiron/52bb63042cf220256ece89bc07fb57b0,