Skip to content

Instantly share code, notes, and snippets.

View gregrickaby's full-sized avatar
:octocat:

Greg Rickaby gregrickaby

:octocat:
View GitHub Profile
@gregrickaby
gregrickaby / functions.php
Created June 7, 2012 13:48
Allow HTML in WordPress Custom Menu Descriptions
/**
* Create HTML list of nav menu items and allow HTML tags.
* Replacement for the native menu Walker, echoing the description.
* This is the ONLY known way to display the Description field.
*
* @see http://wordpress.stackexchange.com/questions/51609/
*
*/
class Description_Walker extends Walker_Nav_Menu {
@gregrickaby
gregrickaby / functions.php
Created June 14, 2012 13:39
Add Google Authorship info to WP <head>
add_action( 'wp_head', 'child_google_authorship', 99 );
/**
* Add Google Authorship info to WP <head>
*
* @author Greg Rickaby
* @since 1.0.0
*/
function child_google_authorship() { ?>
<link rel="author" href="https://plus.google.com/XXXXXXXXXXXX/posts/">';
<?php }
@gregrickaby
gregrickaby / .htaccess
Created July 2, 2012 13:51
Default WordPress.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
@gregrickaby
gregrickaby / text-widget.php
Created September 10, 2012 13:41
Ads in Sidebar
<a href="http://gregrickaby.com/go/genesis-theme" target="_blank">
<img src="http://cdn.gregrickaby.com/affiliate/genesis_125x125.png" alt="Genesis Framework for WordPress" title="Genesis Framework for WordPress" border="0" />
</a>
<a href="http://gregrickaby.com/go/thesis-theme" target="_blank">
<img src="http://cdn.gregrickaby.com/affiliate/thesis_125x125.png" alt="Thesis Theme for WordPress" title="Thesis Theme for WordPress" border="0" />
</a>
<a href="http://gregrickaby.com/go/headway-theme" target="_blank">
<img src="http://cdn.gregrickaby.com/affiliate/headway_125x125.png" alt="Headway Theme for WordPress" title="Headway Theme for WordPress" border="0" />
@gregrickaby
gregrickaby / functions.php
Last active October 21, 2019 02:50
Add Google Fonts to Wordpress (the right way)
<?php
add_action( 'wp_enqueue_scripts', 'child_load_google_fonts' );
/**
* Enqueue Google Fonts using a function
*/
function child_load_google_fonts() {
// Setup font arguments
$query_args = array(
@gregrickaby
gregrickaby / _golden-ratio.scss
Last active August 28, 2023 14:31
Golden Ratio Typography for Sass
//
// Golden Ratio Typography
// --------------------------------------------------
// Golden Ratio Math
//
// Let's do some math so we can build beautiful typography and vertical rhythm.
// For any magic to happen, set the $ContentWidth variable on _variables.scss
// to match your content box width (normally this is 640px, 740px, etc...).
@gregrickaby
gregrickaby / custom.css
Last active December 28, 2020 16:48
CSS markup to make Tiny Tiny RSS look a bit more like Google Reader. Paste this into the Custom CSS box inside "Preferences".
/* Reset
------------------------------------------------------------ */
body#ttrssMain,
body#ttrssPrefs,
body#ttrssLogin,
body {
color: #000;
font-family: "Arial", sans-serif;
font-size: 100%; /* Set to default browser size, 16px */
line-height: 1.5;
@gregrickaby
gregrickaby / functions.php
Last active December 15, 2015 16:59
Add social media icons in Genesis without a plug-in
<?php
// Do NOT include the opening php tag
// pre-html5 hook add_action( 'genesis_before_post_content', 'child_social_media_icons', 5 );
add_action( 'genesis_before_entry_content', 'child_social_media_icons', 5 );
/**
* Social Media Icons without a plugin
*
* Use conditional tags to place on desired posts and pages.
*
@gregrickaby
gregrickaby / style.css
Last active December 17, 2015 12:09
CSS for Social Media Icons (Without a Plug-In)
/* Social Media Icons
------------------------------------------------------------ */
.social-media-icons {
display: block;
height: 25px;
width: 100%;
margin: 0 0 10px;
padding: 0;
}
@gregrickaby
gregrickaby / .aaa-301-redirects-examples.md
Last active November 26, 2018 01:38
301 Redirects with .htaccess

Below are some examples of how to deal with 301 redirects in .htaccess

Place the example code below into .htaccess