Skip to content

Instantly share code, notes, and snippets.

Avatar

Joshua Nelson joshuadavidnelson

View GitHub Profile
@joshuadavidnelson
joshuadavidnelson / coauthor_post_avatar.php
Created Mar 16, 2012
Displaying Co-Authors in Thesis Theme
View coauthor_post_avatar.php
<?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 Mar 20, 2012
Displays information from an RSS Feed.
View feedgator.php
<?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 Dec 21, 2015
Check for and, if not there, add quotation marks to a string
View add-quotes.php
/**
*
* Return string with quotation marks
*
* @author Joshua Nelson
* @link http://joshuadnelson.com
*
*/
function jdn_add_quotation( $string ) {
if( !empty( $string ) ) {
View project_quote.php
<?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 Nov 13, 2013
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.
View force_default_genesis_post_meta.php
<?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 Dec 28, 2015
Use this code to remove or customize the entry title for a specific post type.
View remove-genesis-entry-title-link.php
<?php
/**
*
* Remove Links from Post Titles in Genesis
*
* @author Joshua Nelson
* @link http://joshuadnelson.com
*
*/
@joshuadavidnelson
joshuadavidnelson / remove-default-taxonomies.php
Created Nov 13, 2013
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.
View remove-default-taxonomies.php
<?php
/**
*
* Remove default taxonomies
*
* @link http://w4dev.com/wp/remove-taxonomy/
*
*/
add_action( 'init', 'unregister_taxonomy');
@joshuadavidnelson
joshuadavidnelson / functions.php
Created Nov 19, 2013
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…
View functions.php
<?php
/**
* Place this into your functions file
*
*/
unregister_sidebar( 'sidebar-alt' );
genesis_register_sidebar(
array(
'id' => 'sidebar-alt',
@joshuadavidnelson
joshuadavidnelson / style.css
Created Dec 30, 2013
Social Icon Widget with Settings Page in Genesis Theme Settings
View style.css
/**
*
* 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 Jan 6, 2014
Display all layouts currently available in Genesis
View display-genesis-layouts.php
<?php
$layouts = genesis_get_layouts();
foreach( $layouts as $layout => $value ) {
$layout_options[] = $layout;
}
print_r( $layout_options );
You can’t perform that action at this time.