Skip to content

Instantly share code, notes, and snippets.

Avatar
🏖️
Santa Monica WordPress Developer

Austin Passy thefrosty

🏖️
Santa Monica WordPress Developer
View GitHub Profile
@thefrosty
thefrosty / get-post-by-slug.php
Last active Jun 5, 2020
Validate REST API requests by slug, and set proper response 404 status when not found.
View get-post-by-slug.php
<?php declare(strict_types=1);
/**
* Get Post By Slug
* @wordpress-plugin
* Plugin Name: Not Found Posts by Slug to 404
* Description: Validate REST API requests by slug, and set proper response 404 status when not found.
* Author: Austin Passy
* Author URI: https://github.com/thefrosty
* Version: 1.0.0
@thefrosty
thefrosty / mailhog-mamp.md
Created Jun 27, 2018 — forked from jaredatch/mailhog-mamp.md
Install MailHog with MAMP Pro
View mailhog-mamp.md

Install MailHog with MAMP Pro, using HomeBrew.

MailHog

First let's make sure HB is updated. Open up terminal for the following steps.

$ brew update
@thefrosty
thefrosty / wp-rest-api-cache.php
Created Feb 1, 2018
WpRestApiCache Controller
View wp-rest-api-cache.php
<?php
/**
* WpRestApiCache Controller.
* This file extend the wp-rest-api-cache plugin that allows filtering of
* cache depending on conditions met.
*
* @package BeachbodyOnDemand\WpRestApiCache
*/
namespace BeachbodyOnDemand\WpRestApiCache;
@thefrosty
thefrosty / Add2faMetaBox.php
Created May 4, 2017
Dovedi and WP User Profiles support.
View Add2faMetaBox.php
<?php
namespace Dwnload\Plugins\Dovedi;
/**
* Class Add2faMetaBox
*
* @package Dwnload\Plugins\Dovedi
*/
class Add2faMetaBox {
@thefrosty
thefrosty / wp-cl-customizer.php
Created Feb 22, 2016
Basic WordPress customizer setting.
View wp-cl-customizer.php
<?php
namespace Passy;
add_action( 'customize_register', __NAMESPACE__ . '\\customize_register' );
function customize_register( WP_Customize_Manager $wp_customize ) {
$wp_customize->add_panel( 'custom_login_settings',
array(
@thefrosty
thefrosty / cron.class.php
Last active Aug 29, 2015 — forked from Jonathonbyrd/cron.class.php
Wordpress Cron Job Class. Makes Cronning a snap!
View cron.class.php
<?php
/**
* @Author Anonymous
* @link http://www.redrokk.com
* @Package Wordpress
* @SubPackage RedRokk Library
* @copyright Copyright (C) 2011+ Redrokk Interactive Media
*
* @version 0.1
*/
@thefrosty
thefrosty / admin.ajax.php
Created Mar 4, 2015
For testing perposes. This responds with 'heartbeat' when running. But when Clicking 'insert into post' or insert custom link (nav menu) among a few others the POST action never get's triggered. In my console I get 302 found, then a GET request to the home page. Example video: http://quick.as/1oovhyzj
View admin.ajax.php
if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post ) ) {
die($_POST['action']);
add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 );
}
@thefrosty
thefrosty / httpd-vhosts.conf
Created Feb 6, 2015
Localhost Wildcard Subdomains
View httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/Users/austinpassy/Documents/Websites/thefrosty.net/html"
ServerName thefrosty.dev
ServerAlias thefrosty.dev *.thefrosty.dev
<Directory "/Users/austinpassy/Documents/Websites/thefrosty.net/html">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
@thefrosty
thefrosty / ap-show-template.php
Last active Aug 29, 2015
Which WordPress tempalte are you currently one? http://wp.me/p4gJ2a-Be
View ap-show-template.php
function ap_show_template() {
// bail early
if ( is_admin() || !is_user_logged_in() )
return;
if ( !is_admin_bar_showing() || !current_user_can( 'edit_files' ) )
return;
global $template, $wp_admin_bar;
@thefrosty
thefrosty / edd-popular-downloads.php
Created Jan 23, 2015
Get popular downloads for recent XX days. Easy Digital Downloads.
View edd-popular-downloads.php
You can’t perform that action at this time.