Skip to content

Instantly share code, notes, and snippets.

View BeardedGinger's full-sized avatar

Josh Mallard BeardedGinger

View GitHub Profile
@BeardedGinger
BeardedGinger / Logged-in user template
Created December 21, 2013 05:09
Get different templates based on whether or not the visitor is logged in
if ( is_user_logged_in() ) {
get_template_part( 'home', 'loggedin' );
} else {
get_template_part( 'home', 'notloggedin' );
}
@BeardedGinger
BeardedGinger / gist:7879412
Created December 9, 2013 19:36
Check if the post has content - WordPress
<?php
//* Check if the post has content
if ($post->post_content == '') {
//* Content if post is empty
}
//* Alternate
if (get_post()->post_content == '') {
//* Content if post is empty
@BeardedGinger
BeardedGinger / Attachment slider in Template
Created October 14, 2013 20:56
Add the Exodus Attachment Slider to the template file of your choice
<?php
/*
* The page you would like to display the slider. This can be a page template or a single-{post-type}.php template
* Must be a page that you can attach images to.
*
*/
//* Enqueue the scripts for this page only
add_action( 'wp_enqueue_scripts', 'exodus_attachment_slider_scripts' );
@BeardedGinger
BeardedGinger / Attachment Slider
Created October 14, 2013 20:40
Add theme support for the attachment slider within the Exodus Framework
<?php
//* Add support for the Attachment Slider
add_theme_support( 'attachment-slider', 'defined_image_size' );
@BeardedGinger
BeardedGinger / Register Link Filter
Last active December 24, 2015 18:39
Filter for the "Register" link on WordPress login screen
@BeardedGinger
BeardedGinger / declare WooCommerce support
Created September 25, 2013 02:21
Declare WooCommerce support
//* Declare WooCommerce Support
add_theme_support( 'woocommerce' );
@BeardedGinger
BeardedGinger / WooCommerce with Genesis
Created September 23, 2013 20:08
WooCommerce Function for the Genesis Framework
function woocommerce_setup_genesis() {
woocommerce_content();
}
@BeardedGinger
BeardedGinger / Upcoming events shortcode
Last active December 23, 2015 06:39
Modern Tribe's Events Calendar Upcoming Events Shortcode
add_shortcode( 'upcoming_events', 'upcoming_events_shortcode' );
/*
* Upcoming Events Shortcode
*
*/
function upcoming_events_shortcode() {
$args = array(
'post_type' => 'tribe_events',
'posts_per_page' => 3
);
@BeardedGinger
BeardedGinger / Scroll Header
Created September 3, 2013 20:28
Add a Scroll Header to Genesis child theme using Exodus Framework
<?php
//* Add support for Scroll Header
add_theme_support( 'scroll-header' );
@BeardedGinger
BeardedGinger / Font Awesome icon font
Created September 3, 2013 20:02
Add Font Awesome font icon using Exodus Framework
<?php
//* Add Font Awesome icon font
add_theme_support ( 'icon-font', 'fontawesome' );