Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

David Decker deckerweb

🏠
Working from home
View GitHub Profile
@deckerweb
deckerweb / inc-remove-comments.php
Created Oct 11, 2019 — forked from functionsfile/inc-remove-comments.php
Remove WordPress comments functionality.
View inc-remove-comments.php
<?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 / make-elementor-default-editor.php
Created Sep 10, 2019 — forked from heyfletch/make-elementor-default-editor.php
Make Elementor the Default Editor, Not the WordPress Editor (Gutenberg or Classic)
View make-elementor-default-editor.php
<?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 Apr 8, 2019 — forked from nickcernis/functions.php
Wrap Custom HTML WordPress blocks in a div wrapper
View functions.php
<?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 Mar 26, 2019 — forked from martijn94/wp-admin-add-posts-state.php
Snippet to add post state to a WordPress page
View wp-admin-add-posts-state.php
<?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 ) {
View elementor-form-additional-webhook.php
<?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 / wp-499-up-fix-csv-upload.php
Created Dec 18, 2018 — forked from rmpel/wp-499-up-fix-csv-upload.php
A filter (an mu-plugin) to restore CSV upload functionality to WordPress 4.9.9 and up.
View wp-499-up-fix-csv-upload.php
<?php
/**
* Restore CSV upload functionality for WordPress 4.9.9 and up
*/
add_filter('wp_check_filetype_and_ext', function($values, $file, $filename, $mimes) {
if ( extension_loaded( 'fileinfo' ) ) {
// with the php-extension, a CSV file is issues type text/plain so we fix that back to
// text/csv by trusting the file extension.
$finfo = finfo_open( FILEINFO_MIME_TYPE );
$real_mime = finfo_file( $finfo, $file );
@deckerweb
deckerweb / README-Template.md
Created Oct 16, 2018 — forked from PurpleBooth/README-Template.md
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@deckerweb
deckerweb / get_current_post_type.php
Created Sep 21, 2018 — forked from DomenicF/get_current_post_type.php
Get the current post_type context in the WordPress admin.
View get_current_post_type.php
<?php
/**
* gets the current post type in the WordPress Admin
*/
function get_current_post_type() {
global $post, $typenow, $current_screen;
//we have a post so we can just get the post type from that
if ( $post && $post->post_type ) {
return $post->post_type;
@deckerweb
deckerweb / gist:d03269e18c567d153251e39cb9b5072d
Created Aug 6, 2018 — forked from israelcurtis/gist:3798347
Use the get_post_field() function to get any of the wp_posts column fields #wordpress #php
View gist:d03269e18c567d153251e39cb9b5072d
<?php
echo get_post_field('post_content', $post_id); // retrieve content
echo get_post_field('post_name', $post_id); // retrieve the slug
?>
@deckerweb
deckerweb / facetwp-pagination-genesis-markup.php
Created Jul 27, 2018 — forked from JiveDig/facetwp-pagination-genesis-markup.php
Adjust FacetWP's pager html to match Genesis markup. This allows it to inherit the Genesis theme styles. Used with [facetwp pager="true"]
View facetwp-pagination-genesis-markup.php
<?php
/**
* Style pagination to look like Genesis.
*
* @version 1.0.0
*
* @author Mike Hemberger @JiveDig
*
* @link https://halfelf.org/2017/facetwp-genesis-pagination/