Skip to content

Instantly share code, notes, and snippets.

Greg Schoppe gschoppe

Block or report user

Report or block gschoppe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gschoppe
gschoppe / wp_update_watch.php
Created Dec 6, 2018
WordPress Update Watch
View wp_update_watch.php
<?php
if( !empty($_GET['request']) ) {
$current_version = "";
$url = "https://api.wordpress.org/core/version-check/1.7/";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url
));
$result = curl_exec($curl);
@gschoppe
gschoppe / marvelous-wololo-contact-form.php
Last active Oct 8, 2018 — forked from MarvelousWololo/functions.php
step by step rework of marvelouswololo's contact form code
View marvelous-wololo-contact-form.php
<?php
/*
Plugin Name: Marvelous Wololo Contact Form
Plugin URI: https://gist.github.com/MarvelousWololo/fb6488b1e9ad92c6c8d6fd91ed8b55d4
Description: Adds a custom contact form shortcode
Version: 0.0.1
Author: Marvelous Wololo
Author URI: https://reddit.com/user/MarvelousWololo
*/
@gschoppe
gschoppe / multibox_display_box_dimensions.php
Last active Sep 20, 2018
This function will return formatted HTML to display box dimensions and weights for multibox and non-multibox products
View multibox_display_box_dimensions.php
<?php
function get_multibox_dimension_output( $product_id = false ) {
$product = wc_get_product( $product_id );
if( !$product ) {
return;
}
$output = '';
$boxes = get_post_meta( $product->ID, '_wc-multibox-additional-boxes', true );
@gschoppe
gschoppe / functions.php
Created Aug 21, 2018
Add Featured Image Tag to Timber
View functions.php
<?php
/* populates the twig tag {{ featured_image_tag }} */
add_filter('timber_context', function( $context ){
$context['featured_image_tag'] = get_the_post_thumbnail( null, 'full' );
return $context;
});
@gschoppe
gschoppe / admin-bar-for-weglot.php
Last active Oct 12, 2018
Adds a "Translate" button to the admin bar, on post-edit and front end pages, that links directly to the WeGlot visual editor for that page.
View admin-bar-for-weglot.php
<?php if(!defined('ABSPATH')) { die(); }
/*
Plugin Name: Admin Bar for WeGlot
Plugin URI: https://gschoppe.com
Description: Adds an admin bar link to translate any page on your site
Version: 0.1.0
Author: Greg Schoppe
Author URI: https://gschoppe.com
Text Domain: weglotadminbar
@gschoppe
gschoppe / wp-jslabify-titles.php
Last active Mar 22, 2018
add to functions.php to allow WP jSlabify to slab post titles
View wp-jslabify-titles.php
<?php
add_filter( 'the_title', 'wp_jslabify_title', 10, 2 );
function wp_jslabify_title( $title, $id=0 ) {
$slabbed_post_types = array(
'single' => array( 'post', 'page' ),
'archive' => array(),
'search' => array()
);
$theme = 'ultra';
@gschoppe
gschoppe / upcoming-drafts-alert.php
Created Dec 22, 2017
Sends regular reminder emails to all users with draft posts scheduled for less than X days in the future. Usage: 1. Install and activate WP Utility Script Runner (https://wordpress.org/plugins/wp-utility-script-runner/) 2. Create a "utilities" subfolder in your theme directory 3. Place this file in the utilities folder 4. Go to Tools->Utility Sc…
View upcoming-drafts-alert.php
<?php if(!defined('ABSPATH')) { die(); } // This line ensures that the script is not run directly
/**
* Utility Name: Upcoming Drafts Alert
* Description: Sends an email to blog authors with upcoming or overdue posts
* Author: Greg Schoppe
* Author URI: https://gschoppe.com
* Supports: input, cron
* Version: 1.0.0
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@gschoppe
gschoppe / gjs-disable-attachment-pages.php
Last active Feb 10, 2019
WordPress plugin to properly disable attachment pages. This is not a redirect or forced 404. Attachment pages will simply not exist, and the slug will remain available for other posts and pages..
View gjs-disable-attachment-pages.php
<?php if( ! defined( 'ABSPATH' ) ) { die(); }
/**
* Plugin Name: Disable Attachment Pages
* Plugin URI: https://gschoppe.com/wordpress/disable-attachment-pages
* Description: Completely disable attachment pages the right way. No forced redirects or 404s, no reserved slugs.
* Author: Greg Schoppe
* Author URI: https://gschoppe.com/
* Version: 1.0.0
**/
@gschoppe
gschoppe / mb_string_shim.php
Last active Nov 16, 2017
Shim for servers that do not support mb_string functions. modified from Patchwork. Usage: if(!function_exists('mb_strtolower')) { require_once('mb_string_shim.php'); }
View mb_string_shim.php
<?php
/*
* Copyright (C) 2013 Nicolas Grekas - p@tchwork.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the (at your option):
* Apache License v2.0 (http://apache.org/licenses/LICENSE-2.0.txt), or
* GNU General Public License v2.0 (http://gnu.org/licenses/gpl-2.0.txt).
*/
You can’t perform that action at this time.