Skip to content

Instantly share code, notes, and snippets.

Avatar

Mannie Schumpert mannieschumpert

View GitHub Profile
View Form.jsx
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,
View wordpress-default-rewrites.php
<?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 Aug 29, 2015
WP SEO: Modify SEO Title for Custom Post Type
View gist:6adbae86c4e82f461533
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 Apr 18, 2017
Remove all themes auto-installed by Softaculous on SiteGround
View gist:2f89bcd1eb5a540dad59
# 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}
View SassMeister-input-HTML.html
<div class="container">
<div class="small">
Small
</div>
<div class="large">
Large
</div>
<div class="tiny">
Tiny
</div>
@mannieschumpert
mannieschumpert / gist:3f30e5ffa068a0525915
Created Oct 14, 2014
W3 Total Cache's approach to conditional loading is rather elegant.
View gist:3f30e5ffa068a0525915
<?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 Oct 9, 2014
Remove Gravity Forms' "Add Form" button from all WYSIWYG editors
View gist:e5cec8723247f9490016
<?php
add_filter( 'gform_display_add_form_button', function(){return false;} );
@mannieschumpert
mannieschumpert / gist:aca2fc81f0d00c21e5cb
Last active Aug 29, 2015
Bash loop to test URL propagation, including notifications when propagated
View gist:aca2fc81f0d00c21e5cb
propagate(){
# Reminder for arguments
if [ "$1" == "-h" ]; then
echo "Arguments:
1: URL
2: New IP
Example: website.com 879.30.33.21"
return
fi
View gist:8377fb15429715a2fd09
<?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 Jul 24, 2014
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.3.10)
// Compass (v1.0.0.alpha.20)
// Susy (v2.1.2)
// ----
@import "susy";
@mixin mq-layout(
$mq,
You can’t perform that action at this time.