-
-
Save jasonhobbsllc/56f07e3ffd8760d47572 to your computer and use it in GitHub Desktop.
Staff archive with thumbs on left, as click on images, full bio fades in. From Robin Cornett
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Remove the entry meta in the entry header | |
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); | |
remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); | |
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop | |
add_action( 'genesis_loop', 'custom_do_loop' ); // Add custom loop | |
function custom_do_loop() { | |
// Intro Text (from page content) | |
printf( '<article %s>' , genesis_attr( 'entry') ); | |
global $post; | |
// arguments, adjust as needed | |
$args = wp_parse_args( | |
genesis_get_custom_field( 'query_args' ), | |
array( | |
'post_type' => 'staff', | |
'posts_per_page' => '-1', | |
'post_status' => 'publish', | |
'cat' => $include, | |
'orderby' => 'menu_order', | |
'order' => 'ASC', | |
'paged' => get_query_var( 'paged' ) ) | |
); | |
global $wp_query; | |
$wp_query = new WP_Query( $args ); | |
echo '<div class="thumbs">'; | |
if ( have_posts() ) : | |
while ( have_posts() ) : the_post(); | |
if( 0 == $wp_query->current_post ) { | |
echo '<div class="bio_thumbs active_bio_thumb" id="' . get_the_ID() . '">'; | |
} | |
else { | |
echo '<div class="bio_thumbs" id="' . get_the_ID() . '">'; | |
} | |
echo get_the_post_thumbnail( $post->ID, 'thumbnail' ); | |
echo get_the_title(); // show the title | |
echo '</div>'; | |
} | |
endwhile; | |
do_action( 'genesis_after_endwhile' ); | |
endif; | |
echo '</div>'; //* end .thumbs | |
rewind_posts(); | |
if ( have_posts() ) : | |
while ( have_posts() ) : the_post(); | |
if( 0 == $wp_query->current_post ) { | |
echo '<div class="bio_desc active_desc" id="' . get_the_ID() . '_desc">'; | |
} | |
else { | |
echo '<div class="bio_desc" id="' . get_the_ID() . '_desc" style="display:none;">'; | |
} | |
echo '<h2>' . get_the_title() . '</h2>'; // show the title | |
the_content(); | |
echo '</div>'; | |
} | |
endwhile; | |
do_action( 'genesis_after_endwhile' ); | |
endif; | |
} | |
genesis(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready( function() { | |
jQuery('.bio_thumbs').mouseover(function () { | |
jQuery(this).addClass('hover_bio_thumb'); | |
}).mouseout(function () { | |
jQuery(this).removeClass('hover_bio_thumb'); | |
}).click(function() { | |
jQuery('.bio_thumbs').removeClass('active_bio_thumb'); | |
jQuery(this).addClass('active_bio_thumb'); | |
var bio = jQuery(this).attr('id'); | |
if (jQuery('#' + bio + '_desc').hasClass('active_desc')) { | |
// Do Nothing | |
} | |
else { | |
jQuery('.active_desc').fadeOut(400, function() { | |
jQuery(this).removeClass('active_desc'); | |
jQuery('#' + bio + '_desc').fadeIn(400); | |
jQuery('#' + bio + '_desc').addClass('active_desc'); | |
}); | |
} | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add this to your theme's functions file to call the javascript and set up the widget area. | |
//* Required Scripts | |
add_action ( 'wp_enqueue_scripts', 'rgc_scripts' ); | |
function rgc_scripts() { | |
if ( is_post_type_archive( 'staff' ) ) { | |
wp_enqueue_script( 'rgc-staff', get_stylesheet_directory_uri() . '/lib/js/avenger.js', array( 'jquery' ) ); | |
} | |
} | |
// Register Widget Areas | |
genesis_register_sidebar( array( | |
'id' => 'after-staff', | |
'name' => __( 'After Staff', 'rgc' ), | |
'description' => __( 'This is the after staff section.', 'rgc' ), | |
) ); | |
// Hooks after-staff widget area to Staff Page | |
add_action( 'genesis_after_loop', 'rgc_after_staff' ); | |
function rgc_after_staff() { | |
if ( is_post_type_archive( 'staff' ) && is_active_sidebar( 'after-staff' ) ) { | |
echo '<div class="after-staff"><div class="wrap">'; | |
dynamic_sidebar( 'after-staff' ); | |
echo '</div></div>'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Custom Post Types: place this file in mu-plugins to carry through from one theme to the next, or add this code directly to your functions.php */ | |
add_action( 'init', 'rgc_staff_post_type' ); | |
function rgc_staff_post_type() { | |
register_post_type( 'staff', | |
array( | |
'labels' => array( | |
'name' => __( 'Staff', 'rgc' ), | |
'singular_name' => __( 'Staff', 'rgc' ), | |
), | |
'exclude_from_search' => false, | |
'has_archive' => true, | |
'hierarchical' => true, | |
'public' => true, | |
'rewrite' => array( 'slug' => 'staff' ), | |
'supports' => array( 'title', 'editor', 'thumbnail', 'genesis-cpt-archives-settings', 'page-attributes', 'genesis-seo' ), | |
) | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Staff Archive Page | |
---------------------------------------------------------------------------------- */ | |
.thumbs { | |
float: left; | |
width: 100px; | |
} | |
.bio_thumbs { | |
color: #000; | |
cursor: pointer; | |
margin-bottom: 15px; | |
opacity: .75; | |
text-align: center; | |
} | |
.hover_bio_thumb { | |
opacity: .9; | |
} | |
.active_bio_thumb { | |
opacity: 1; | |
} | |
.bio_desc { | |
float: right; | |
text-align: justify; | |
width: 540px; | |
} | |
.bio_desc.active_desc { | |
display: block; | |
} | |
.after-staff { | |
clear: both; | |
padding-top: 20px; | |
} | |
@media only screen and (max-width: 1139px) { | |
.bio_desc { | |
width: 435px; | |
} | |
} | |
@media only screen and (max-width: 1023px) { | |
.thumbs, | |
.bio_desc { | |
width: 100%; | |
} | |
.bio_thumbs { | |
float: left; | |
width: 100px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment