Skip to content

Instantly share code, notes, and snippets.

View joshuadavidnelson's full-sized avatar

Joshua Nelson joshuadavidnelson

View GitHub Profile
@joshuadavidnelson
joshuadavidnelson / coauthor_post_avatar.php
Created March 16, 2012 21:57
Displaying Co-Authors in Thesis Theme
<?php
/* ------ [ Display Post Avatars w/ Co-Author Alternate ] ------ */
function custom_author_post_avatar(){
if(is_home() || is_single()){
if ( function_exists( 'get_coauthors' ) && 1 == count( get_coauthors( get_the_id() ) ) ) {
if(get_query_var('author_name')){
$curauth = get_userdatabylogin(get_query_var('author_name'));
}else{
$curauth = get_userdata(get_query_var('author'));
}
@joshuadavidnelson
joshuadavidnelson / feedgator.php
Created March 20, 2012 17:53
Displays information from an RSS Feed.
<?php
/* ------ [ "FeedGator" Rss Aggregator ] ------ */
function rss_agg($feed,$num,$desc) {
include_once(ABSPATH . WPINC . '/feed.php');
$rss = fetch_feed($feed);
if(!empty($rss)):
$maxitems = $rss->get_item_quantity($num);
$rss_items = $rss->get_items(0, $maxitems);
endif;
@joshuadavidnelson
joshuadavidnelson / add-quotes.php
Last active December 21, 2015 04:08
Check for and, if not there, add quotation marks to a string
/**
*
* Return string with quotation marks
*
* @author Joshua Nelson
* @link http://joshuadnelson.com
*
*/
function jdn_add_quotation( $string ) {
if( !empty( $string ) ) {
<?php
/**
* Project Quote
*
*/
function be_project_quote() {
global $wp_query, $be_testimonials;
if( !( ( 5 < $wp_query->found_posts && 5 == $wp_query->current_post ) || ( $wp_query->current_post == ( $wp_query->found_posts - 1 ) && 5 > $wp_query->found_posts ) ) )
return;
@joshuadavidnelson
joshuadavidnelson / force_default_genesis_post_meta.php
Created November 13, 2013 04:18
this bit in your functions.php file will force specific settings for robots post meta. Change 'post' to a specific post type or replace with other conditional.
<?php
/**
*
* Force Default Robot Options on Post Type ('post' in this case)
*
* @author: Joshua Nelson
* @link: http://joshuadnelson.com
*
*/
@joshuadavidnelson
joshuadavidnelson / remove-genesis-entry-title-link.php
Last active December 28, 2015 04:39
Use this code to remove or customize the entry title for a specific post type.
<?php
/**
*
* Remove Links from Post Titles in Genesis
*
* @author Joshua Nelson
* @link http://joshuadnelson.com
*
*/
@joshuadavidnelson
joshuadavidnelson / remove-default-taxonomies.php
Created November 13, 2013 04:41
Remove category and tag taxonomies. Useful if you're not using the blog functionality of WordPress, including the taxonomies. Be sure to uncomment the other line if you're using Genesis to avoid errors.
<?php
/**
*
* Remove default taxonomies
*
* @link http://w4dev.com/wp/remove-taxonomy/
*
*/
add_action( 'init', 'unregister_taxonomy');
@joshuadavidnelson
joshuadavidnelson / functions.php
Created November 19, 2013 18:26
Alternative Sidebar Page Template in Genesis. The default description for the built-in secondary sidebar doesn't really apply, so first we'll unregister that sidebar and re-register it with our preferred description. Then create a new page template, called something like template-alt-sidebar.php for instance. Now you'll see the secondary sidebar…
<?php
/**
* Place this into your functions file
*
*/
unregister_sidebar( 'sidebar-alt' );
genesis_register_sidebar(
array(
'id' => 'sidebar-alt',
@joshuadavidnelson
joshuadavidnelson / style.css
Created December 30, 2013 17:10
Social Icon Widget with Settings Page in Genesis Theme Settings
/**
*
* Styles for Social Media Icons for Genesis
*
*/
.sidebar ul.socials,
ul.socials {
list-style-type: none;
float: right;
@joshuadavidnelson
joshuadavidnelson / display-genesis-layouts.php
Created January 6, 2014 15:22
Display all layouts currently available in Genesis
<?php
$layouts = genesis_get_layouts();
foreach( $layouts as $layout => $value ) {
$layout_options[] = $layout;
}
print_r( $layout_options );