Skip to content

Instantly share code, notes, and snippets.

View dlxsnippets's full-sized avatar

DLX Snippets dlxsnippets

View GitHub Profile
@dlxsnippets
dlxsnippets / ms-detection.php
Created August 22, 2024 15:18
Function to Determine if Multisite is Active and Enabled
<?php
/**
* Checks if the plugin is on a multisite install.
*
* @param bool $network_admin Check if in network admin.
* @param bool $network_activated Check if plugin is network activated.
* @param string $plugin_file Path to the plugin file.
*
* @return true if multisite, false if not.
*/
@dlxsnippets
dlxsnippets / useMediaUploader.js
Last active July 18, 2024 16:50
MediaUpload Library React Hook for Uploading Images
import { __ } from '@wordpress/i18n';
const getCropSettings = ( overrides = {} ) => {
// Set the settings for the media uploader and cropper.
let settings = {
id: '',
attachmentId: 0,
aspectRatio: '1:1',
suggestedWidth: '500',
suggestedHeight: '500',
nonce: '',
@dlxsnippets
dlxsnippets / blueprint.json
Last active April 6, 2024 08:21
Sample Blueprint File for Highlight and Share
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"preferredVersions": {
"php": "8.0",
"wp": "6.5"
},
"features": {
"networking": true
},
"phpExtensionBundles": [
@dlxsnippets
dlxsnippets / register-multiple-admin-menu-locations-wp.php
Created October 22, 2023 02:21
Register Multiple Admin Menu Locations in WordPress
<?php
/**
* Plugin Name: Fancy Tools: Multiple Admin Menu Locations
* Plugin URI: https://dlxplugins.com
* Description: A demo plugin showing how to register a menu in multiple locations.
* Version: 1.0.0
* Requires at least: 6.0
* Requires PHP: 7.3
* Author: DLX Plugins
* Author URI: https://dlxplugins.com
@dlxsnippets
dlxsnippets / fullscreen-wp-admin.php
Created August 24, 2023 08:43
Demonstration of Creating a Fullscreen Admin
<?php
/**
* Plugin Name: Fullscreen Admin Panel.
* Plugin URI: https://dlxplugins.com
* Description: A demo plugin to create a fullscreen admin panel.
* Version: 1.0.0
* Requires at least: 6.0
* Requires PHP: 7.3
* Author: DLX Plugins
* Author URI: https://dlxplugins.com
@dlxsnippets
dlxsnippets / change-image-block-attributes-block-editor.php
Created July 10, 2023 19:20
Change Image Block Attributes with Default Overrides
<?php
/**
* Plugin Name: DLX Change Image Attributes
* Plugin URI: https://dlxplugins.com
* Description: Change the align and default link settings for an image.
* Version: 1.0.0
* Requires at least: 6.0
* Requires PHP: 7.3
* Author: Ronald Huereca
* Author URI: https://mediaron.com
@dlxsnippets
dlxsnippets / block-editor-change-paragraph-placeholder-text.php
Created July 10, 2023 18:59
Change the Paragraph Block's Placeholder Text
<?php
/**
* Plugin Name: DLX Change Paragraph Placeholder
* Plugin URI: https://dlxplugins.com
* Description: Change the placeholder text for the paragraph block.
* Version: 1.0.0
* Requires at least: 6.0
* Requires PHP: 7.3
* Author: Ronald Huereca
* Author URI: https://mediaron.com
@dlxsnippets
dlxsnippets / akismet-search-query-spam-check.php
Last active June 4, 2023 19:37
Pass Search Queries Through Akismet for Spam Checking
<?php
/**
* Plugin Name: Akismet Search Check
* Plugin URI: https://mediaron.com
* Description: Filter search terms through Akismet
* Version: 1.0.0
* Requires at least: 6.0
* Requires PHP: 7.3
* Author: Ronald Huereca
* Author URI: https://mediaron.com
@dlxsnippets
dlxsnippets / membership-plus.php
Created February 12, 2023 22:27
How to Redirect After Plugin Activation
<?php
/**
* Plugin Name: Memberships Plus
* Plugin URI: https://dlxplugins.com/plugins/
* Description: A Pro membership plugin.
* Version: 1.0.0
* Requires at least: 5.8
* Requires PHP: 7.2
* Author: DLX Plugins
* Author URI: https://dlxplugins.com
@dlxsnippets
dlxsnippets / dlx-remove-core-and-third-party-block-patterns.php
Created January 25, 2023 07:53
Remove Core and Third-party Block Patterns
<?php
/**
* Plugin Name: DLX Remove Block Patterns
* Plugin URI: https://dlxplugins.com/plugins/alertsdlx/
* Description: Remove Block Patterns and third-party patterns.
* Version: 1.1.0
* Requires at least: 6.0
* Requires PHP: 7.2
* Author: DLX Plugins
* Author URI: https://dlxplugins.com