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 / get-related-posts.php
Last active August 24, 2016 15:25
Related posts by category with tag fallback
@gregrickaby
gregrickaby / recent-post-with-images.php
Last active January 2, 2019 10:42
Recent Posts with Images
<?php
/*
Plugin Name: Recent Posts with Images
Plugin URI: http://webdevstudios.com
Description: Display recent posts with images filterable by category or post type in a widget area.
Version: 1.0.0
Author: WebDevStudios
Author URI: http://webdevstudios.com
License: GPLv2
Text Domain: textdomain
@gregrickaby
gregrickaby / sticky-cpt.php
Last active August 29, 2015 14:01
Make a CPT post sticky anytime it's updated
<?php
add_action( 'save_post', 'child_sticky_factory', 99 );
/**
* Allow sticky posts in a CPT
*/
function child_sticky_factory() {
$post_id = get_the_ID();
$stickem = get_post_meta( $post_id, '_child_sticky', true );
@gregrickaby
gregrickaby / infinite-scroll-masonry-imagesloaded.php
Last active June 14, 2023 13:01
Infinite Scroll + Masonry + ImagesLoaded
/**
* Be sure to include library scripts in this order. Can be placed either
* in the header or footer.
*/
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js"></script>
@gregrickaby
gregrickaby / functions.php
Last active January 25, 2023 12:50
Custom RSS template for WordPress
<?php
add_action( 'after_setup_theme', 'my_rss_template' );
/**
* Register custom RSS template.
*/
function my_rss_template() {
add_feed( 'short', 'my_custom_rss_render' );
}
@gregrickaby
gregrickaby / feed-short.php
Last active January 25, 2023 12:50
Custom RSS template for WordPress
<?php
/**
* Customs RSS template with related posts.
*
* Place this file in your theme's directory.
*
* @package sometheme
* @subpackage theme
*/
@gregrickaby
gregrickaby / feed-short.php
Last active January 25, 2023 12:50
Custom RSS Template for WordPress
<?php
/**
* Customs RSS feed with related posts.
*
* Place this file in your theme's directory.
*
* @package sometheme
* @subpackage theme
*/
@gregrickaby
gregrickaby / grd_functions.php
Last active April 10, 2018 02:38
A "must use" plugin to help save theme-agnostic functions
<?php
/**
* Must-Use Functions
*
* A class filled with functions that will never go away upon theme deactivation.
*
* @package WordPress
* @subpackage GRD
*/
class GRD_Functions {
@gregrickaby
gregrickaby / 1140px-grid.css
Last active January 2, 2019 10:44
Responsive Grid with Gutters - Example Markup
/* Grid
12 column - http://responsive.gs
--------------------------------------------- */
.row {
padding-bottom: 0;
}
.col {
float: left;
width: 100%;
@gregrickaby
gregrickaby / _mixins.scss
Created September 12, 2013 22:14
The ultimate SASS - PX to REM mixin
// Create REM values with PX fall back
//
// Generate a REM with PX fallback from
// $baseFontSize. Enter the desired size based
// on pixels in numerical form. Supports shorthand.
//
// Forked from: http://codepen.io/thejameskyle/pen/JmBjc
//
// @author Greg Rickaby
// @since 1.0