Skip to content

Instantly share code, notes, and snippets.

@ryanshoover
ryanshoover / subscribe-form.html
Last active March 16, 2017 15:18
Velocitize Subscribe Button
<!--
TO DO: Replace the value {{CONTACT.EMAIL_ADDRESS}} with whatever templating tag you use to insert the
receiver's email address into the email.
-->
<!-- Begin MailChimp Signup Form -->
<style type="text/css">
#mc-embedded-subscribe:hover, #mc-embedded-subscribe:focus {background: #333;}
</style>
<form action="https://velocitize.us1.list-manage.com/subscribe/post?u=97713b16d0e25d9d4cc92a2a9&amp;id=c42a252727" method="post" target="_blank">
@ryanshoover
ryanshoover / functions.php
Created April 7, 2017 02:31
Child theme starter
<?php
/**
* Functions for Ryan Hoover Child
*/
namespace RSH;
define( 'RSH_PATH', get_stylesheet_directory() );
define( 'RSH_URL', get_stylesheet_directory_uri() );
@ryanshoover
ryanshoover / single.php
Created April 7, 2017 03:18
Simple Loop
<?php
get_header();
while ( have_posts() ) : the_post();
the_title();
the_content();
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
@ryanshoover
ryanshoover / .gitignores-__default
Last active January 16, 2020 21:44
CircleCI deploy script to WP Engine
# Ignore everything in the root except the "wp-content" directory.
/*
!.git*
!wp-content/
!circle.yml
!composer.json
!auth.json
!package.json
!Gruntfile.js
@ryanshoover
ryanshoover / circle.yml
Last active March 1, 2018 17:40
~DEPRECATED~ CircleCI 1.0 YAML script for continuous integration with a WP Engine install. CircleCI 1.0 is deprectaed. Check out a CircleCI 2.0 configuration at https://gist.github.com/ryanshoover/ce4bb081b95168840b8c51b2a033c500
machine:
environment:
WPE_INSTALL: myinstallname
php:
version: 7.0.17
## Wordpress Code standard
dependencies:
pre:
# Grunt v 1.0.1 only passes installation if it's installed globally
@ryanshoover
ryanshoover / find-big-css-files.php
Created June 20, 2017 18:18
Find un-minified CSS files in a website
<?php
/**
* Find the number of unminified CSS files on a website
* @param string $url The root URL of the website to test
* @param integer $lines_per_file What's the max number of lines a minified CSS file should have?
* @return integer Number of CSS files on a website that aren't minified
*/
function how_many_unminified_css_files( $url, $lines_per_file = 3 )
$unminimized_css_files = 0;
@ryanshoover
ryanshoover / functions.php
Last active August 15, 2017 15:52
GeoIP-based pricing pages
<?php
// !! Don't paste the <?php line above !!
/**
* Redirect any pricing pages to my country's pricing page
*/
function redirect_pricing_page() {
$path = $_SERVER['REQUEST_URI'];
@ryanshoover
ryanshoover / codecheck.sh
Created August 21, 2017 18:44
Plugin Audit
#!/bin/bash
default_path='.'
pluginpath=${1:-$default_path}
declare -a types=("full" "source")
for type in ${types[@]}
do
echo Running PHPCS report: ${type}
@ryanshoover
ryanshoover / .circleci config.yml
Last active July 26, 2024 07:45
CircleCI 2.1 Continuous Integration with WP Engine
# Continuous Integration to a WP Engine install
# PHP CircleCI 2.1 configuration file
# Requirements:
# 1. In CircleCI settings, add environment variables for your site's installs:
# * WPE_PRODUCTION_INSTALL=thenameofyourproductioninstall
# * WPE_STAGING_INSTALL=thenameofyourstaginginstall
# * WPE_DEVELOPMENT_INSTALL=thenameofyourdevelopmentinstall
# 2. In your repo, have two files
# * `./.gitignores/__default` -- Excludes any compiled files
@ryanshoover
ryanshoover / woocommerce-shayda.php
Created January 2, 2018 22:23
Shayda's WooCommerce Tweaks
<?php
/**
* Plugin Name: Shayda's WooCommerce Tweaks
* Plugin URI: http://dinewithshayda.com
* Description: Makes WooCommerce do what Shayda demands it should do.
* Version: 1.0
* Author: shayda
* Author URI: http://dinewithshayda.com
*
* @package woocommerce-shayda