Skip to content

Instantly share code, notes, and snippets.

View mannieschumpert's full-sized avatar

Mannie Schumpert mannieschumpert

View GitHub Profile
import React, { createContext, useState } from 'react';
export const FormContext = createContext();
const Form = ({ handleSubmit, children, submitButtonText }) => {
const [values, setValues] = useState({});
const setValue = ({ name, value }) => {
setValues(values => ({
...values,
<?php
array(
'^wp-json/?$' => 'index.php?rest_route=/',
'^wp-json/(.*)?' => 'index.php?rest_route=/$matches[1]',
'category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
'category/(.+?)/embed/?$' => 'index.php?category_name=$matches[1]&embed=true',
'category/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]',
'category/(.+?)/?$' => 'index.php?category_name=$matches[1]',
'tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
@mannieschumpert
mannieschumpert / gist:6adbae86c4e82f461533
Last active August 29, 2015 14:11
WP SEO: Modify SEO Title for Custom Post Type
add_filter( 'wpseo_replacements', 'mannie_filter_seo_replacements' );
function mannie_filter_seo_replacements( $replacements ){
global $post;
if ( isset( $replacements['%%title%%'] ) && $post->post_type === 'project' )
$replacements['%%title%%'] = 'Project: ' . $replacements['%%title%%'];
return $replacements;
}
@mannieschumpert
mannieschumpert / gist:2f89bcd1eb5a540dad59
Last active April 18, 2017 16:56
Remove all themes auto-installed by Softaculous on SiteGround
# move into the themes folder
cd public_html/wp-content/themes
# remove unwanted themes
# of course remove the older WP default themes from the script if you want to keep them
rm -rf -- {Builder-Cohen,Builder-Paige,World,siteground-wp23,siteground-wp73,Builder-Madison,Universe,siteground-wp63,twentythirteen,twentytwelve}
@mannieschumpert
mannieschumpert / SassMeister-input-HTML.html
Created October 23, 2014 18:59
Generated by SassMeister.com.
<div class="container">
<div class="small">
Small
</div>
<div class="large">
Large
</div>
<div class="tiny">
Tiny
</div>
@mannieschumpert
mannieschumpert / gist:3f30e5ffa068a0525915
Created October 14, 2014 15:37
W3 Total Cache's approach to conditional loading is rather elegant.
<?php
/**
* Skip caching for some pages
*/
switch (true) {
case defined('DONOTCACHEPAGE'):
case defined('DOING_AJAX'):
case defined('DOING_CRON'):
case defined('APP_REQUEST'):
@mannieschumpert
mannieschumpert / gist:e5cec8723247f9490016
Created October 9, 2014 21:01
Remove Gravity Forms' "Add Form" button from all WYSIWYG editors
<?php
add_filter( 'gform_display_add_form_button', function(){return false;} );
@mannieschumpert
mannieschumpert / gist:aca2fc81f0d00c21e5cb
Last active August 29, 2015 14:07
Bash loop to test URL propagation, including notifications when propagated
propagate(){
# Reminder for arguments
if [ "$1" == "-h" ]; then
echo "Arguments:
1: URL
2: New IP
Example: website.com 879.30.33.21"
return
fi
<?php
function unregister_all_widgets() {
unregister_widget('WP_Widget_Pages');
unregister_widget('WP_Widget_Calendar');
unregister_widget('WP_Widget_Archives');
unregister_widget('WP_Widget_Links');
unregister_widget('WP_Widget_Meta');
unregister_widget('WP_Widget_Search');
unregister_widget('WP_Widget_Text');
unregister_widget('WP_Widget_Categories');
@mannieschumpert
mannieschumpert / SassMeister-input.scss
Created July 24, 2014 17:48
Generated by SassMeister.com.
// ----
// Sass (v3.3.10)
// Compass (v1.0.0.alpha.20)
// Susy (v2.1.2)
// ----
@import "susy";
@mixin mq-layout(
$mq,