Skip to content

Instantly share code, notes, and snippets.

View deckerweb's full-sized avatar
🏠
Working from home

David Decker deckerweb

🏠
Working from home
View GitHub Profile
@deckerweb
deckerweb / wp-admin-add-posts-state.php
Created March 26, 2019 21:14 — forked from martijn94/wp-admin-add-posts-state.php
Snippet to add post state to a WordPress page
<?php
//======================================================================
// Add post state to the projects page
//======================================================================
add_filter( 'display_post_states', 'ecs_add_post_state', 10, 2 );
function ecs_add_post_state( $post_states, $post ) {
@deckerweb
deckerweb / gist:b7e70a52ed76b6486795
Last active August 8, 2021 02:39
WordPress Forms plugin comparison table - by David Decker (@deckerweb) of deckerweb.de
@deckerweb
deckerweb / unload-elementor-textdomain.php
Last active August 1, 2021 15:04
Unload Elementor Textdomain -- below Code Snippet should go into "Code Snippets" plugin at best (please avoid functions.php or similar hacks)!
<?php
/** Do NOT include the opening php tag */
add_action( 'plugins_loaded', 'ddw_unload_elementor_textdomain' );
/**
* Unload Textdomain for "Elementor" and "Elementor Pro" plugins.
* (Comment functions out for those not wanted to unload.)
*
* @author David Decker - DECKERWEB
@deckerweb
deckerweb / astra-remove-metaboxes-for-nonadmins.php
Last active June 10, 2021 06:07
Remove Meta Boxes on Post & Page Edit Screens from "Astra" Theme and "Astra Pro" Plugin for users who are not Administrators, so Editors and below. Inspired by user question: https://www.facebook.com/groups/wpastra/permalink/367143130421624/ -- below Code Snippet should go into "Code Snippets" plugin at best (please avoid functions.php)!
<?php
/** Do NOT include the opening php tag */
add_action( 'do_meta_boxes', 'ddw_remove_astra_metaboxes_for_non_admins' );
/**
* Remove Astra settings meta box for users that are not administrators
* Inspired by: https://www.facebook.com/groups/wpastra/permalink/367143130421624/?comment_id=367167440419193&comment_tracking=%7B%22tn%22%3A%22R1%22%7D
*
* @author David Decker - DECKERWEB
@deckerweb
deckerweb / gist:2643807
Created May 9, 2012 11:13
BuddyPress Toolbar plugin v1.2+ -- hooks, filters and constants for customizing and branding
<?php
// since plugin version v1.2:
// Hooks:
add_action( 'bptb_custom_group_items', 'bptb_custom_additional_group_item' );
/**
* BuddyPress Toolbar: Custom Resource Group Items
*
@deckerweb
deckerweb / make-elementor-default-editor.php
Created September 10, 2019 16:04 — forked from heyfletch/make-elementor-default-editor.php
Make Elementor the Default Editor, Not the WordPress Editor (Gutenberg or Classic)
<?php
/**
* Make Elementor the default editor, not the WordPress Editor (Gutenberg or Classic)
* Clicking the page title will take you to the Elementor editor directly
* Even non-Elementor-edited pages will become Elementor-edited pages now
* You can revert by clicking the "Back to WordPress Editor" button
*
* Author: Joe Fletcher, https://fletcherdigital.com
* URL: https://gist.github.com/heyfletch/7c59d1c0c9c56cbad51ef80290d86df7
@deckerweb
deckerweb / functions.php
Created September 7, 2012 10:23
bbPress: Change Forums Archive Title - When in Forums Archive & within Breadcrumbs Display
<?php
add_filter( 'bbp_get_forum_archive_title', 'ddw_bbpress_change_forum_archive_title' );
/**
* Change Forums Archive Title in bbPress 2.x plugin version.
*
* Changes the title on Forums Archive page (forums parent page).
* NOTE: Also changes the title in the breadcrumbs display to the same value!
*
* @author David Decker - DECKERWEB
@deckerweb
deckerweb / contactform7.php
Created January 28, 2013 21:47
Contact Form 7 plugin: Clean up global scripts & styles.
<?php
add_action( 'wp_enqueue_scripts', 'ddw_cf7_cleanup' );
/**
* Contact Form 7 plugin: Cleanup global scripts & styles.
*
* @author David Decker - DECKERWEB
* @link http://deckerweb.de/twitter
*/
function ddw_cf7_cleanup() {
@deckerweb
deckerweb / elementor-remove-wp-widgets.php
Created September 11, 2019 06:48
For Elementor Page Builder Plugin: Remove the regular WordPress Widgets from the left-hand Panel in the Live Editor. --- CAUTION: Use at your own risk! No support here!!!
<?php
/** Do NOT include the opening php tag */
if ( ! function_exists( 'ddw_tweak_elementor_remove_wp_widgets' ) ) :
add_filter( 'elementor/widgets/black_list', 'ddw_tweak_elementor_remove_wp_widgets' );
/**
* Optionally remove all WordPress widgets from the Elementor Live Editor.
* Note: A native Elementor filter is used.
@deckerweb
deckerweb / maybe-add-post-states-for-blocks.php
Last active November 8, 2019 10:51
Adds optional new post states if a Post has Blocks, has the "Classic" Block or no Blocks at all. *** Note: This respects also the popular "Disable Gutenberg" plugin (free, by Jeff Starr) which allows for disabling the "Block Editor" for entire post types.
<?php
/** Do NOT include the opening php tag */
if ( ! function_exists( 'ddw_cf_maybe_add_post_state_blocks' ) ) :
add_filter( 'display_post_states', 'ddw_cf_maybe_add_post_state_blocks', 10, 2 );
/**
* Adds optional new post states if a Post has Blocks, has the "Classic" Block or no Blocks at all.
*