Skip to content

Instantly share code, notes, and snippets.

Brady Vercher bradyvercher

Block or report user

Report or block bradyvercher

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
@bradyvercher
bradyvercher / register-plugin-icons.php
Created Oct 4, 2017
Register icons to display on the Manage Plugins screen for plugins that aren't in the WordPress.org directory.
View register-plugin-icons.php
<?php
/**
* Register plugin icons.
*
* WordPress 4.9 introduced icons in the list table on the Manage Plugins
* screen. The icons are pulled from the W.org update API. If an icon isn't
* available, a generic plugin Dashicon is shown instead.
*
* @param array $value Plugin update data.
* @return array
@bradyvercher
bradyvercher / readme.md
Created Apr 27, 2016
Configure WordPress to send email through an SMTP server.
View readme.md

WordPress SMTP Configuration

Usage

  1. Install and activate the smtp-config.php file as a plugin or drop it in /mu-plugins.
  2. Define the necessary constants in wp-config.php.

Configuration Examples

MailHog

@bradyvercher
bradyvercher / helpscout-rest-controller.php
Created Mar 10, 2016
A starter WP REST API controller for creating a Dynamic App for Help Scout. http://developer.helpscout.net/custom-apps/dynamic/
View helpscout-rest-controller.php
<?php
/**
* Help Scout REST controller class.
*
* @license GPL-2.0+
* @link http://developer.helpscout.net/custom-apps/dynamic/
*/
class HelpScout_REST_Controller {
/**
* Secret key.
@bradyvercher
bradyvercher / discussion-view.php
Last active Aug 29, 2015
Rough proof of concept to display blog posts similar to a topic view in a forum. Save the file as a plugin and drop the [discussion] shortcode in a page.
View discussion-view.php
<?php
/**
* Plugin Name: Discussion View
* Version: 0.1.0
* Description: Display blog posts similar to a the topic view in a forum.
* Author: Brady Vercher
*/
class DiscussionView {
public function load() {
@bradyvercher
bradyvercher / wpsc-split-the-query-fix.php
Created Jul 18, 2014
Allow pre_get_posts hooks attached after WP eCommerce's wpsc_split_the_query() to run.
View wpsc-split-the-query-fix.php
<?php
/**
* Plugin Name: WP eCommerce Query Hotfix
* Description: Allow pre_get_posts hooks attached after wpsc_split_the_query() to run.
*/
/**
* Fix 'pre_get_post' hooks when WP eCommerce is active.
*
* The wpsc_split_the_query() pre_get_posts callback attempts to run only once
@bradyvercher
bradyvercher / git-update-skip.php
Last active Oct 2, 2015
Exclude plugins with a composer.json or .git directory from update checks. Based on concept by @Rarst: https://gist.github.com/Rarst/9992974
View git-update-skip.php
<?php
add_filter( 'http_request_args', function( $r, $url ) {
// If this isn't an update request, bail immediately.
// Regex source: https://github.com/cftp/external-update-api/blob/master/external-update-api/euapi.php#L45
if ( false === strpos( $url, 'api.wordpress.org' ) || ! preg_match( '#://api\.wordpress\.org/(?P<type>plugins|themes)/update-check/(?P<version>[0-9.]+)/#', $url, $matches ) ) {
return $r;
}
$api_type = $matches['type'];
$api_version = floatval( $matches['version'] );
@bradyvercher
bradyvercher / child-theme.js
Last active Aug 29, 2015
A concept for overriding parent theme JavaScript in a child theme.
View child-theme.js
window.themeName = window.themeName || {};
(function( window, $, undefined ) {
'use strict';
// Override the carousel config properties.
themeName.config.carousel.autoPlay = true;
themeName.setupCarousel = function() {
// Override the carousel set up without affecting anything else.
@bradyvercher
bradyvercher / cpt-class.mustache
Created Feb 27, 2014
Mustache templates for generating WordPress CPT code.
View cpt-class.mustache
/**
* {{singular}} CPT
*
* @package {{plural}}
* @author Your Name <email@example.com>
* @license http://www.gnu.org/licenses/gpl-2.0.html
* @link http://www.blazersix.com/wordpress-code-generators/
*
* @todo Remove unused code and update where needed.
*
@bradyvercher
bradyvercher / cache-post-thumbnails.php
Created Jan 9, 2014
WordPress: Cache post thumbnail attachments that appear in a WP_Query loop.
View cache-post-thumbnails.php
<?php
/**
* Plugin Name: Cache Post Thumbnails
* Description: Prime the post thumbnails cache for individual loops.
* Version: 1.0.0
* Author: Brady Vercher
* Author URI: http://www.blazersix.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@bradyvercher
bradyvercher / americanaura-widget-classes.php
Created Dec 27, 2013
Methods for retrieving widget instances.
View americanaura-widget-classes.php
<?php
function americanaura_widget_classes( $params ) {
if ( 'pinboard' != $params[0]['id'] ) {
return $params;
}
// If a track has a file add a '.js-playable' class to the widget container
if ( 'audiotheme-track' == $widget_id_base ) {
$instance = americanaura_get_widget_instance( $params[0]['widget_id'], $params[1]['number'] );
if ( isset( $instance['post_id'] ) && get_audiotheme_track_file_url( $instance['post_id'] ) ) {
You can’t perform that action at this time.