Skip to content

Instantly share code, notes, and snippets.

View dlxsnippets's full-sized avatar

DLX Snippets dlxsnippets

View GitHub Profile
@dlxsnippets
dlxsnippets / dlx-is-plugin-activated.php
Created September 11, 2025 19:04
Checks if a Plugin is Active on Single-Site or Multisite
<?php
/**
* Checks to see if an asset is activated or not.
*
* @param string $path Path to the asset (e.g., akismet/akismet.php).
*
* @return bool true if activated, false if not.
*/
function dlx_is_plugin_activated( $path ) {
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
@dlxsnippets
dlxsnippets / edd-schema-shortcode.php
Created May 27, 2025 02:27
Output EDD Schema on Another Page Using edd_structured_data shortcode
<?php
/**
* Plugin Name: DLX EDD Output Schema Download
* Description: Outputs the structured data for a download.
* Version: 1.0.0
* Author: Ronald Huereca
* Author URI: https://dlxplugins.com
* Text Domain: dlx-edd-output-schema-download
* Domain Path: /languages
*/
@dlxsnippets
dlxsnippets / ms-detection.php
Last active September 11, 2025 18:56
Function to Determine if Multisite is Active and Enabled
/**
* Checks if the plugin is on a multisite install and if plugin is active for network.
*
* @param bool $network_admin Whether to check if in the network admin.
* @param bool $network_activated Whether the plugin is active for the network.
* @param mixed $plugin_file Path to the plugin file.
*
* @return bool True if multisite, false if not. If in network admin, true if plugin is active for network, false if not. If not in network admin, true if plugin is active for the site, false if not.
*/
function dlx_is_multisite( $network_admin = false, $network_activated = false, $plugin_file = __FILE__ ) {
@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