Skip to content

Instantly share code, notes, and snippets.

@brycejacobson
brycejacobson / genesis_remove_shiv.php
Created August 23, 2013 18:00
Remove html5 shiv from Genesis and add Modernizr instead
<?php
//* Do NOT include opening php tag
//* Remove Genesis hmlt5 shiv and add Modernizr instead
remove_action( 'wp_head', 'genesis_html5_ie_fix' );
add_action( 'wp_head', 'add_mondernizr' );
function add_mondernizr() {
if ( ! genesis_html5() )
return;
@brycejacobson
brycejacobson / genesis_2_loop.php
Created August 30, 2013 16:11
Genesis 2.0 Loop with hooks
<?php
//* Do NOT include opening php tag
function genesis_standard_loop() {
//** Use old loop hook structure if < HTML5
if ( ! genesis_html5() ) {
genesis_legacy_loop();
return;
}
@brycejacobson
brycejacobson / functions.php
Created August 30, 2013 18:32
Genesis filter classes in content area.
<?php
//* do not include php tag
add_filter( 'genesis_attr_content', 'custom_add_content_attr' );
function custom_add_content_attr( $attributes ){
// add itemscope
$attributes['class'] = 'content first two-thirds';
@brycejacobson
brycejacobson / functions.php
Created August 30, 2013 18:38
Genesis custom context with filter and callback to append the custom attributes.
<?php
add_filter( 'genesis_attr_movie', 'custom_add_movie_attr' );
/**
* Callback for dynamic Genesis 'genesis_attr_$context' filter.
*
* Add custom attributes for the custom filter.
*
* @param array $attributes The element attributes
* @return array $attributes The element attributes
@brycejacobson
brycejacobson / get_the_term_list.php
Created September 4, 2013 19:33
Get the custom taxonomy category of a custom post type in WordPress with no link.
<li><strong>Category:</strong> <?php $terms_as_text = get_the_term_list( $post->ID,'gallery_category', '', ', ');
if (!empty($terms_as_text)) echo '', strip_tags($terms_as_text) ,''; ?></li>
@brycejacobson
brycejacobson / soliloquy_dynamic_slider.php
Created September 4, 2013 19:36
Get the images attached to a post and make a Soliloquy Dynamic Slider.
<?php
//* Get images attached to post and make a slider
add_action( 'genesis_after_header', 'scw_gallery_slider', 2 );
function scw_gallery_slider() {
soliloquy_dynamic( array( 'id' => get_the_ID() ) );
}
@brycejacobson
brycejacobson / get_child_terms.php
Created September 5, 2013 19:32
WordPress get child terms of current taxonomy page and display them.
<?php
$taxonomy_name = get_queried_object()->name; // Get the name of the taxonomy
$term_id = get_queried_object_id(); // Get the id of the taxonomy
$termchildren = get_term_children( $term_id, $taxonomy_name ); // Get the children of said taxonomy
// Display the children
echo '<tr>';
foreach ( $termchildren as $child ) {
$term = get_term_by( 'id', $child, $taxonomy_name );
@brycejacobson
brycejacobson / genesis_move_featured_image.php
Created September 7, 2013 03:13
Move the featured image in Genesis.
@brycejacobson
brycejacobson / move_gravity_forms_jQuery.php
Created September 11, 2013 20:00
Move Gravity Forms jQuery Calls to Footer
<?php
// Move Gravity Forms jQuery calls to footer
add_filter("gform_init_scripts_footer", "init_scripts");
function init_scripts() {
return true;
}
?>
@brycejacobson
brycejacobson / pods_image_attachment.php
Created September 12, 2013 14:38
Get Pods Image Attachment
<?php
add_action( 'genesis_before_entry_content', 'nutrition_facts', 15 );
function nutrition_facts() {
if ( get_post_meta( get_the_ID(), 'nutrition_facts_image', true ) ) : ?>
<p class="nutrition-facts"><?php echo pods_image( get_post_meta( get_the_ID(), 'nutrition_facts_image', true ), 'full' ); ?></p>
<?php endif;
}