Skip to content

Instantly share code, notes, and snippets.

View ericrasch's full-sized avatar

Eric Rasch ericrasch

View GitHub Profile
@ericrasch
ericrasch / WP Disable Comments.md
Last active February 13, 2018 17:29
If you need to completely shut off all comments/trackbacks/pingbacks in the WordPress Admin

To shut off all comments/trackbacks/pingbacks in the WordPress Admin, the steps for cleanup are:

@ericrasch
ericrasch / htaccess.md
Created January 31, 2018 21:00
redirect http non-www to https
@ericrasch
ericrasch / Collapsable Content functions.php
Last active July 4, 2017 03:55
Create collapsable content sections using WordPress' the_content().
/* =BEGIN: Add Class to first Paragraph in WordPress the_content();
Source: http://wordpress.stackexchange.com/a/51682/28826
---------------------------------------------------------------------------------------------------- */
function first_paragraph($content){
// Finding the 1st p tag and adding a class.
$content = preg_replace('%<p([^>]+)?>%', '<p$1 class="intro">', $content, 1);
// Finding the 1st closing p tag and adding a div tag to the rest of the content so we can separate it.
$content = preg_replace('%</p>%', '</p> <div id="collapsable-content">', $content, 1);
@ericrasch
ericrasch / TypeKit embed code.php
Last active July 4, 2017 03:54
Different methods for loading TypeKit's embed code.
<?php
/**
* TypeKit's default embed code.
* Source: http://help.typekit.com/customer/portal/articles/649336-embed-code
* Avg. Load Time: 191ms; 198ms; 265ms
*/
?>
<script type="text/javascript" src="//use.typekit.net/xxxxxxx.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
@ericrasch
ericrasch / WP Ping Services
Last active July 4, 2017 03:54
A list of ping services to use in the WordPress admin.
http://bing.com/webmaster/ping.aspx
http://blo.gs/ping.php
http://blog.goo.ne.jp/XMLRPC
http://blog.with2.net/ping.php
http://blogpingr.de/ping/rpc2
http://blogsearch.google.com/ping/RPC2
http://ping.bitacoras.com/
http://ping.fc2.com/
https://feedburner.google.com/fb/a/ping
http://ping.wordblog.de/
@ericrasch
ericrasch / Set Custom WP Feeds.php
Last active July 4, 2017 03:53
Add this code to your Theme's functions.php file.
<?php
/* =BEGIN: Remove WP generated junk from head
Source: http://digwp.com/2010/03/wordpress-functions-php-template-custom-functions/
---------------------------------------------------------------------------------------------------- */
function removeHeadLinks() {
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wp_generator' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'feed_links_extra', 3 );

Proper HTML Formatting

Just wanted a simple resource for referencing the proper way to correctly format HTML code.

A Pen by Eric Rasch on CodePen.

License.

@ericrasch
ericrasch / SassMeister-input-HTML.html
Created July 18, 2014 16:34
Generated by SassMeister.com.
<section id="scrollNav-1" class="scroll-nav__section">
<h2>
Title with no class
</h2>
<div>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.</p>
</div>
<hr>
</section>
@ericrasch
ericrasch / HTML5 Keyboard Input Types.js
Created August 28, 2014 15:10
HTML5 Input Types for Touch Keyboards
$('<input type="email" id="lead_email_alt" name="lead[email]" required="required" placeholder="E-mail Address" class=" form field text _lead_email ">').insertAfter('input#lead_email');
$('input#lead_email').remove();
$('<input type="tel" id="lead_phone_alt" name="lead[phone]" required="required" placeholder="Phone Number" class=" form field text phone _lead_phone ">').insertAfter('input#lead_phone');
$('input#lead_phone').remove();
$('<input type="text" autocorrect="off" id="lead_address_alt" name="lead[address]" required="required" placeholder="Street Address" class=" form field text _lead_address ">').insertAfter('input#lead_address');
$('input#lead_address').remove();
$('<input type="number" pattern="\d*" id="lead_zipCode_alt" name="lead[zipCode]" required="required" placeholder="Zip Code" class=" form field text _lead_zipCode ">').insertAfter('input#lead_zipCode');
@ericrasch
ericrasch / Detect WordPress template file.php
Created December 3, 2014 18:31
Detect + display WordPress template file being used
<?php
/**
* Detect + display WordPress template file being used
* REF: http://www.wpmayor.com/output-name-of-wordpress-template-file-being-used/#comment-8221
*/
add_action('wp_head', 'show_template');
function show_template() {
global $template;
global $current_user;