Skip to content

Instantly share code, notes, and snippets.

View JiveDig's full-sized avatar

Mike Hemberger JiveDig

View GitHub Profile
@JiveDig
JiveDig / enter_title_here_text.php
Created November 6, 2013 15:07
Change custom post type "Enter title here" text
// Change the "Enter title here" to "Enter book title here" for Books
add_filter('gettext', 'book_custom_rewrites', 10, 4);
function book_custom_rewrites($translation, $text, $domain) {
global $post;
if ( ! isset( $post->post_type ) ) {
return $translation;
}
$translations = &get_translations_for_domain($domain);
$translation_array = array();
@JiveDig
JiveDig / new_gist_file.php
Created November 6, 2013 15:22
// NOT WORKING SINCE 1.0 ? Change the Easy Digital Downloads (EDD) menu position. Any value from this page will work: http://codex.wordpress.org/Function_Reference/register_post_type
// Change the EDD 'Downloads' menu position
define('EDD_MENU_POSITION', 25);
@JiveDig
JiveDig / edd_download_slug.php
Created November 6, 2013 17:51
Change Easy Digital Downloads (EDD) 'download' slug to something else. Refresh permalinks after changing this.
// Change 'download' slug to something else
define('EDD_SLUG', 'books');
@JiveDig
JiveDig / footer_credits.php
Created November 6, 2013 18:24
Customize the footer credits
@JiveDig
JiveDig / change_breadcrumbs.php
Created November 7, 2013 20:02
Change the Genesis breadcrumbs
// Change breadcrumb text/args
add_filter( 'genesis_breadcrumb_args', 'child_breadcrumb_args' );
function child_breadcrumb_args( $args ) {
$args['home'] = 'Home';
$args['sep'] = ' / ';
$args['list_sep'] = ', '; // Genesis 1.5 and later
$args['prefix'] = '<div class="breadcrumb">';
$args['suffix'] = '</div>';
$args['heirarchial_attachments'] = true; // Genesis 1.5 and later
$args['heirarchial_categories'] = true; // Genesis 1.5 and later
@JiveDig
JiveDig / new_gist_file.php
Created November 7, 2013 21:51
Allow HTML in taxonomy term description
// Allow HTML in term descriptions
foreach ( array( 'pre_term_description' ) as $filter ) {
remove_filter( $filter, 'wp_filter_kses' );
}
foreach ( array( 'term_description' ) as $filter ) {
remove_filter( $filter, 'wp_kses_data' );
}
@JiveDig
JiveDig / add_post_thumbnail_with_class.php
Created November 8, 2013 15:21
Add new post thumbnail if it exists Add class to thumbnail
if ( has_post_thumbnail() ) {
the_post_thumbnail('book-thumbnail', array('class' => 'new-class') );
}
@JiveDig
JiveDig / link_featured_image_to_post.php
Created November 8, 2013 15:26
Link featured image (post thumbnail) to the post. Use the_title_attribute()
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('book-thumbnail', array('class' => 'book-thumbnail')); ?></a>
@JiveDig
JiveDig / show_single_term.php
Created November 8, 2013 16:03
Show single term of a taxonomy
$term_name = single_cat_title( $prefix = '', $display = false );
echo '<h1 class="entry-title" itemprop="headline">' . $term_name . '</h1>';
@JiveDig
JiveDig / register_new_widget_area.php
Created November 8, 2013 19:55
Register new Genesis widget area
//* Register widget areas
genesis_register_sidebar( array(
'id' => 'after-post',
'name' => __( 'After Post', 'theme-name' ),
'description' => __( 'This is the widget that appears after a single posts.', 'theme-name' ),
) );