Skip to content

Instantly share code, notes, and snippets.

View dougedgington's full-sized avatar

Doug Edgington dougedgington

View GitHub Profile
@dougedgington
dougedgington / shortcodes.php
Last active December 15, 2015 03:19
Output custom post type in a grid via shortcode in WordPress.
<?php
/*
Author: Doug Edgington
Description: Shortcode to output custom post type in a grid
*/
function dee_display_bios() {
$args = array(
'post_type' => 'dee_bios',
'orderby' => 'title',
<?php
/*
Author: Doug Edgington
Description: Shortcode to output recent posts from one category
*/
function dee_display_recent_posts() {
$args = array(
'post_type' => 'post',
'posts_per_page'=> 5,
'cat'=> 4,
<?php
/*enable shortcode in text widget*/
add_filter('widget_text', 'do_shortcode');
@dougedgington
dougedgington / functions.php
Last active December 15, 2015 15:39
Register Sidebar called top-message with the Genesis Framework
<?php
/*
Description: Top message sidebar with the Genesis Framework
*/
genesis_register_sidebar( array(
'id' => 'top-message',
'name' => __( 'Top Message', 'themename' ),
'description' => __( 'This is the top of site message widget area.', 'themename' ),
) );
@dougedgington
dougedgington / functions.php
Created April 1, 2013 07:45
Output sidebar above the header with the Genesis Framework
<?php
/*
Author: Doug Edgington
Description: If sidebar is active, output sidebar above header with the Genesis Framework
*/
add_action( 'genesis_before_header', 'dee_do_top_message' );
function dee_do_top_message() {
if ( is_active_sidebar( 'top-message' ) ) {
echo '<div id="top-message">';
@dougedgington
dougedgington / functions.php
Last active December 17, 2015 18:39
Require a minimum order total in Woocommerce for a user role
<?php
/*
Author: Doug Edgington
Description: Require a minimum order total in Woocommerce for a user role
*/
function dee_minimum_order_total_required() {
if( is_user_logged_in() ) {
@dougedgington
dougedgington / shortcodes.php
Created May 27, 2013 01:43
Shortcode to display a minimum order total required message to users in a specific user role on checkout page when using Woocommerce
<?php
/*
Author: Doug Edgington
Description: Shortcode to display a minimum order total required message to
users in a specific user role on checkout page when using Woocommerce
*/
function dee_minimum_order_total_message() {
@dougedgington
dougedgington / shortcodes.php
Last active December 19, 2015 13:39
Shortcode to display WordPress bookmark links (Blog Roll)
<?php
/*
Author: Doug Edgington
Description: Shortcode to display WordPress bookmark links (Blog Roll).
Used to add links to a page rather than a sidebar using the WordPress links widget.
*/
function dee_display_bookmark_links() {
$args = array(
@dougedgington
dougedgington / functions.php
Last active December 20, 2015 12:59
Force SSL on Woocommerce pages and two additional custom pages
<?php
/*
Author: Doug Edgington
Description: modified version of Woocomemrce SSL functionality, forces ssl on Woocommerce pages and two additional custom pages
*/
function dee_ssl_template_redirect() {
if ( ! is_ssl() ) {
if ( is_checkout() || is_account_page() || is_page(48) || is_page(64) ) {
@dougedgington
dougedgington / functions.php
Created August 7, 2013 20:53
Genesis - move sidebar div above content div
<?php
remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
add_action('genesis_before_content', 'genesis_get_sidebar');
?>