Skip to content

Instantly share code, notes, and snippets.

@carlodaniele
carlodaniele / media-hacks.php
Last active March 28, 2024 20:19
An example WP plugin which adds functionalities to the WordPress Media Library
<?php
/**
* @package Media_hacks
* @version 1.0
*/
/*
Plugin Name: Media hacks
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele
<?php
/**
* @package Smashing_plugin
* @version 1.0
*/
/*
Plugin Name: Smashing plugin
Plugin URI: https://www.smashingmagazine.com/2016/03/advanced-wordpress-search-with-wp_query/
Description: This is an example plugin for Smashing Magazine readers.
Author: Carlo Daniele
@carlodaniele
carlodaniele / plugin.js
Created December 3, 2016 08:55
A TinyMCE plugin which adds a custom dropdown menu.
(function() {
var languages = ['css', 'php', 'html', 'javascript'];
tinymce.PluginManager.add( 'prism', function( editor ){
var items = [];
tinymce.each( languages, function( languageName ){
items.push({
text: languageName,
@carlodaniele
carlodaniele / tinymce-example-plugin.php
Created December 3, 2016 08:47
An example WP plugin to show how to register TinyMCE plugins in WordPress
<?php
/**
* @package TinyMCE_example_plugin
* @version 1.0
*/
/*
Plugin Name: TinyMCE example plugin
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Your Name
@carlodaniele
carlodaniele / text-editor.php
Last active October 1, 2019 20:36
This is an example of usage of the WordPress Quicktags API, quicktags_settings filter and wp_editor function. This is not a ready-to-use plugin
<?php
/**
* Add scripts to admin page footer
*
* @since 2.8.0
*
*/
function my_quicktags() {
if ( wp_script_is( 'quicktags' ) ) {
@carlodaniele
carlodaniele / food-example-plugin-2.php
Created November 15, 2016 20:59
An example for WPMU readers
<?php
/**
* @package Food_example_plugin_2
* @version 1.0
*/
/*
Plugin Name: Food example plugin 2
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin for WPMU DEV readers
Author: Carlo Daniele
@carlodaniele
carlodaniele / custom-queries.php
Last active January 23, 2024 01:35
An example plugin showing how to add custom query vars, rewrite tags and rewrite rules to WordPress
<?php
/**
* @package Custom_queries
* @version 1.0
*/
/*
Plugin Name: Custom queries
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele
@carlodaniele
carlodaniele / kinsta-share-users.php
Last active December 11, 2023 15:34
A plugin to share users and usermeta tables between independent WordPress installations. This plugin requires CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE defined into wp-config file
<?php
/**
* @package Kinsta_Share_Users
* @version 1.0
*/
/*
Plugin Name: Kinsta Share Users
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin for Kinsta blog readers
Author: Carlo Daniele
@carlodaniele
carlodaniele / REST-API-my-meta-fields.php
Created August 17, 2016 14:51
Adds latitude and longitude post meta field values to REST API response.
<?php
/**
* @package REST_API_my_meta_fields
* @version 1.0
*/
/*
Plugin Name: REST API my meta fields
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele
@carlodaniele
carlodaniele / cd-hide-wordpress-version.php
Last active September 23, 2021 16:01
This plugin hides all WP versions from the head of the document and anables auto updates. It could be placed in /wp-content/mu-plugin folder
<?php
/**
* @package CD Hide WordPress Version
* @version 1.0
*/
/*
Plugin Name: CD Hide WordPress Version
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This plugin removes the version number from WordPress pages
Author: Carlo Daniele