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 / 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 / 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 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 / wp-499-up-fix-csv-upload.php
Created December 18, 2018 22:13 — 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.
<?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 October 16, 2018 16:07 — forked from PurpleBooth/README-Template.md
A template to make good README.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 September 21, 2018 22:54 — forked from DomenicF/get_current_post_type.php
Get the current post_type context in the WordPress admin.
<?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 August 6, 2018 14:59 — forked from israelcurtis/gist:3798347
Use the get_post_field() function to get any of the wp_posts column fields #wordpress #php
<?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 July 27, 2018 09:03 — 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"]
<?php
/**
* Style pagination to look like Genesis.
*
* @version 1.0.0
*
* @author Mike Hemberger @JiveDig
*
* @link https://halfelf.org/2017/facetwp-genesis-pagination/