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 / 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.
*
@deckerweb
deckerweb / sermon-manager-german-bibles.php
Last active November 6, 2019 17:43
Plugin - Sermon Manager for WordPress: Adds German Bible translations from biblia.com to the Bible select field in the plugin settings - that way you can offer also verse links in German language ;-)
<?php
/** Do NOT include the opening php tag */
if ( ! function_exists( 'ddw_sm_bible_selection' ) ) :
add_filter( 'sm_verse_settings', 'ddw_sm_bible_selection' );
/**
* Plugin: Sermon Manager for WordPress
* For "Verse" settings add German bible versions from biblia.com
@deckerweb
deckerweb / inc-remove-comments.php
Created October 11, 2019 19:09 — forked from functionsfile/inc-remove-comments.php
Remove WordPress comments functionality.
<?php
/**
* Code taken from the plugin 'Remove Comments Absolutely' by Frank Bültge
* http://wpengineer.com/2230/removing-comments-absolutely-wordpress/
* https://github.com/bueltge/Remove-Comments-Absolutely/blob/master/remove-comments-absolute.php
* http://bueltge.de/
*/
if ( ! class_exists( 'Remove_Comments_Absolute' ) ) {
add_action( 'plugins_loaded', array( 'Remove_Comments_Absolute', 'get_object' ) );
@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 / 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 / v1-tbex-unloading-translations-premium-addons.php
Last active May 13, 2019 15:04
Toolbar Extras plugin: Unload also translations for the Elementor Add-On "Premium Addons for Elementor" (free, by Leap13) --- website: https://toolbarextras.com
<?php
/** Do NOT include the opening php tag */
/** Version 1 - strict unloading */
if ( ! function_exists( 'ddw_tbex_unload_textdomain_premium_addons' ) ) :
add_action( 'init', 'ddw_tbex_unload_textdomain_premium_addons' );
/**
@deckerweb
deckerweb / functions.php
Created April 8, 2019 20:03 — forked from nickcernis/functions.php
Wrap Custom HTML WordPress blocks in a div wrapper
<?php
add_filter( 'render_block', 'custom_wrap_html_block_output', 10, 2 );
/**
* Wrap output of HTML blocks.
*
* @param string $block_content Original block content.
* @param array $block Block info.
* @return string The block content with a wrapper.
*/
@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 / elementor-form-additional-webhook.php
Created February 12, 2019 12:40 — forked from csalzano/elementor-form-additional-webhook.php
Elementor Form additional webhook example
<?php
/**
* Plugin Name: Elementor Form Additional Webhook
* Plugin URI: https://coreysalzano.com/
* Description: Adds a second Webhook to the Lot Wizard trial signup form
* Version: 1.0.0
* Author: Corey Salzano
* Author URI: https://github.com/mistercorey
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@deckerweb
deckerweb / tbex-custom-cap-unloading-translations.php
Last active December 21, 2018 15:39
Toolbar Extras plugin v1.3.9+: Set a custom capability for unloading translations
<?php
/** Do NOT include the opening php tag */
if ( function_exists( 'tbex_capability_unloading_translations' ) ) :
add_filter( 'tbex_filter_capability_unloading_translations', 'tbex_capability_unloading_translations' );
/**
* Set a custom capability for the Smart Tweak feature for unloading certain translations.
* This filter is available since Toolbar Extras version 1.3.9
*