Skip to content

Instantly share code, notes, and snippets.

View wpscholar's full-sized avatar
😀
Happy

Micah Wood wpscholar

😀
Happy
View GitHub Profile
@wpscholar
wpscholar / disable-auto-generated-excerpts.php
Last active September 18, 2019 14:11
This plugin will prevent WordPress from automatically generating an excerpt when one is not explicitly set.
<?php
/*
* Plugin Name: Disable Auto-Generated Excerpts
* Plugin URI: https://gist.github.com/wpscholar/8da60a1f2e1a89d07348491a11725597
* Description: This plugin will prevent WordPress from automatically generating an excerpt when one is not explicitly set.
* Version: 1.0
* Author: Micah Wood
* Author URI: https://wpscholar.com
* License: GPL2
<?php
/*
* Plugin Name: WP REST API Demo
* Plugin URI: https://gist.github.com/wpscholar/693517420ca6c9e29e7719ef24e7e00f
* Description: A developer plugin designed for playing around with the WordPress REST API.
* Version: 1.0
* Author: Micah Wood
* Author URI: https://wpscholar.com
* License: GPL2
<?php
/*
* Plugin Name: WP REST API - Allow All CORS Requests
* Description: Adds headers to allow cross-origin requests to the WordPress REST API.
* Version: 1.0
* Plugin URI: https://gist.github.com/wpscholar/59f5708cba291a314375b2dedd104e1e
* Author: Micah Wood
* Author URI: https://wpscholar.com
*/
@wpscholar
wpscholar / wc-product-gallery-disable-zoom.php
Created May 29, 2019 13:22
Disable image zoom in the WooCommerce Product Gallery.
@wpscholar
wpscholar / simple-website-redirect-not-homepage.php
Last active May 25, 2019 14:49
A plugin to extend the Simple Website Redirect plugin and prevent redirects from happening on the homepage.
<?php
/*
* Plugin Name: Simple Website Redirect - Don't redirect homepage
* Plugin URI: https://gist.github.com/wpscholar/122e6132b7ff58cc67019339283ca25a
* Description: A plugin to extend the Simple Website Redirect plugin and prevent redirects from happening on the homepage.
* Version: 1.0
* Author: Micah Wood
* Author URI: https://wpscholar.com
* License: GPL2
@wpscholar
wpscholar / config.yml
Created April 22, 2019 23:48
CircleCI Rsync Deployment
version: 2
jobs:
build_and_deploy:
docker:
- image: circleci/php:7.1-node-browsers
steps:
- checkout
- run: sudo apt update
- run: sudo apt-get install rsync
- run: sudo docker-php-ext-install zip
var url = "";
var params = {
name: 'John',
email: 'webmaster@mysite.com'
};
var xhr = new XMLHttpRequest();
xhr.open('POST', url + '?' + buildQueryString(params));
@wpscholar
wpscholar / webpack.config.js
Last active March 15, 2022 01:06
Get started with WebPack in WordPress today!
'use strict';
const autoprefixer = require('autoprefixer');
const browsers = require('@wordpress/browserslist-config');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
const webpack = require('webpack');
module.exports = function (env, options) {
@wpscholar
wpscholar / cloudSettings
Last active July 18, 2020 18:11
Visual Studio Code Settings
{"lastUpload":"2020-07-18T18:11:37.497Z","extensionVersion":"v3.4.3"}
@wpscholar
wpscholar / nav-login-logout.php
Last active March 15, 2022 01:18
Automatically append login and logout links to a specific menu location.
<?php
add_filter(
'wp_nav_menu_items',
function( $items, $args ) {
if ( 'primary_nav' === $args->theme_location ) {
if ( is_user_logged_in() ) {
$items .= '<li><a title="Log Out" href="' . esc_url( wp_logout_url() ) . '">' . __( 'Log Out', 'cobb-realtors' ) . '</a></li>';
} else {
$items .= '<li><a title="Login" href="' . esc_url( wp_login_url() ) . '">' . __( 'Login', 'cobb-realtors' ) . ' </a ></li >';