Skip to content

Instantly share code, notes, and snippets.

View JiveDig's full-sized avatar

Mike Hemberger JiveDig

View GitHub Profile
@JiveDig
JiveDig / gist:5834083
Last active December 18, 2015 19:39
Use WP_Query To Alter The Posts Per Page Of A Custom Taxonomy Term Archive Of A Custom Post Type. When using Post Types Order plugin ( ) add: 'orderby' => 'menu_order', to the $args
<?php
//* Replace the standard loop with our custom loop
//* props to David Wang, he is the man!
// @author David Wang
// @link http://genesissnippets.com/genesis-custom-loop/
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_do_custom_loop' );
function child_do_custom_loop() {
@JiveDig
JiveDig / change_login_logo.php
Last active December 26, 2015 19:19
Change login logo and link. logo.png goes in /child_theme/images/ directory
/**
* Change login logo
* Max image width should be 320px
* @link http://andrew.hedges.name/experiments/aspect_ratio/
*/
add_action('login_head', 'rgt_custom_dashboard_logo');
function rgt_custom_dashboard_logo() {
echo '<style type="text/css">
.login h1 a {
background-image:url('.get_stylesheet_directory_uri().'/images/logo.png) !important;
@JiveDig
JiveDig / remove_post_content.php
Created October 29, 2013 02:34
Remove post content
//* Remove the post content (requires HTML5 theme support)
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
@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 / 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 / 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' ),
) );
@JiveDig
JiveDig / display_widget_area.php
Last active December 27, 2015 19:19
Display a genesis widget area
<?php
if ( is_active_sidebar( 'after-entry' ) ) {
genesis_widget_area( 'after-entry', array(
'before' => '<div class="after-entry">',
'after' => '</div>',
) );
}
@JiveDig
JiveDig / featured_image_on_single_post.php
Created December 4, 2013 21:45
Show featured image (post thumbnail) on single posts
<?php
// Show featured image on single posts
add_action( 'genesis_before_entry_content', 'child_featured_post_image', 8 );
function child_featured_post_image() {
if ( ! is_singular( 'post' ) ) return;
the_post_thumbnail('post-image');
}
@xeoncross
xeoncross / domdocument_encoding.php
Last active December 18, 2024 19:46
Fix HTML encoding errors with PHP DOMDocument
<?php
// Ignore errors
libxml_use_internal_errors(true) AND libxml_clear_errors();
// http://stackoverflow.com/q/10237238/99923
// http://stackoverflow.com/q/12034235/99923
// http://stackoverflow.com/q/8218230/99923
// original input (unknown encoding)