Skip to content

Instantly share code, notes, and snippets.

View raewrites's full-sized avatar

Raelene Morey raewrites

View GitHub Profile
@raewrites
raewrites / disable-php-execution
Created July 19, 2016 04:45
Disable PHP Execution
<Files *.php>
Order Allow, Deny
Deny from all
</Files>
@raewrites
raewrites / hide-admin-toolbar.php
Created January 29, 2016 02:15
Hide Admin Toolbar
add_filter('show_admin_bar', '__return_false');
@raewrites
raewrites / excerpt-character-counter.php
Created February 25, 2015 06:09
Excerpt Character Counter
function excerpt_count_js(){
if ('page' != get_post_type()) {
echo '<script>jQuery(document).ready(function(){
jQuery("#postexcerpt .handlediv").after("<div style=\"position:absolute;top:12px;right:34px;color:#666;\"><small>Excerpt length: </small><span id=\"excerpt_counter\"></span><span style=\"font-weight:bold; padding-left:7px;\">/ 500</span><small><span style=\"font-weight:bold; padding-left:7px;\">character(s).</span></small></div>");
jQuery("span#excerpt_counter").text(jQuery("#excerpt").val().length);
jQuery("#excerpt").keyup( function() {
if(jQuery(this).val().length > 500){
jQuery(this).val(jQuery(this).val().substr(0, 500));
@raewrites
raewrites / image-compression-80.php
Created January 28, 2015 05:03
Image Compression at 80%
add_filter( 'jpeg_quality', create_function( '', 'return 80;' ) );
@raewrites
raewrites / backend-code-global-options.php
Last active December 19, 2019 23:27
Backend Code for Global Options
/*===================================================================================
* Add global options
* =================================================================================*/
/**
*
* The page content surrounding the settings fields. Usually you use this to instruct non-techy people what to do.
*
*/
function theme_settings_page(){
@raewrites
raewrites / front-end-display-variables.php
Created January 29, 2016 03:02
Front-end Code to Display Variables
<!-- ==== Contact Information ==== -->
<?php
/**
* 1. First we can check if the support phone number is filled out.
* 2. If it is, let's show the phone number, otherwise we'll show a slightly famous message :).
* 3. Hit the pub to celebrate!
*/
@raewrites
raewrites / remove-wordpress-version
Last active December 12, 2019 10:53
Remove WordPress Version
function remove_version() {
return '';
}
add_filter('the_generator', 'remove_version');
@raewrites
raewrites / twenty-sixteen-theme-definition
Created June 29, 2016 07:54
Twenty Sixteen Theme Definition
/*
Theme Name: Twenty Sixteen
Theme URI: https://wordpress.org/themes/twentysixteen/
Author: the WordPress team
Author URI: https://wordpress.org/
Description: Twenty Sixteen is a modernized take on an ever-popular WordPress layout — the horizontal masthead with an optional right sidebar that works perfectly for blogs and websites. It has custom color options with beautiful default color schemes, a harmonious fluid grid using a mobile-first approach, and impeccable polish in every detail. Twenty Sixteen will make your WordPress look beautiful everywhere.
Version: 1.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: black, blue, gray, red, white, yellow, dark, light, one-column, two-columns, right-sidebar, fixed-layout, responsive-layout, accessibility-ready, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-images, flexible-header, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, tran
@raewrites
raewrites / create-simple-products-woo
Last active October 1, 2018 03:48
Create Simple Products WooCommerce
wp wc product create -–name="Test Product" --type=simple --sku=WCCLITESTP --regular_price=20 –user
@raewrites
raewrites / create-expired-silver-membership
Last active July 4, 2018 08:22
Create expired silver membership
wp wc memberships membership create --customer=1 --plan="silver" --start_date="2016-01-01" --end_date="2016-06-30" --status="expired"