Skip to content

Instantly share code, notes, and snippets.

@WebEndevSnippets
Created January 15, 2013 15:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save WebEndevSnippets/4539308 to your computer and use it in GitHub Desktop.
Save WebEndevSnippets/4539308 to your computer and use it in GitHub Desktop.
remove_action( 'genesis_header', 'genesis_do_header' );
add_action( 'genesis_header', 'shireman_do_custom_header' );
/**
* Modify the default header, including the #title-area div,
* along with #title and #description.
*
* Calls the genesis_site_title, and genesis_site_description.
*
* Adds book thumbnail display.
*
*/
function shireman_do_custom_header() {
echo '<div id="title-area">';
do_action( 'genesis_site_description' );
do_action( 'genesis_site_title' );
echo '</div><!-- end #title-area -->';
if (is_home()) {
echo '<div class="book-area">';
function shireman_books_header_loop() {
global $post;
$args = array(
'meta_key' => 'header_order',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'post_type' => 'we_published-book',
'posts_per_page' => 9,
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'we_book-category',
'field' => 'id',
'terms' => array( 78 ),
)
)
);
$bookthumbs = new WP_Query( $args );
if ( $bookthumbs->have_posts() ) :
echo '<ul>';
while ( $bookthumbs->have_posts() ) : $bookthumbs->the_post();
$img = genesis_get_image( array( 'format' => 'html', 'size' => 'book-small' ) );
if(has_post_thumbnail()) {
printf( '<li><a href="%s" title="%s"><span class="roll" ></span>%s</a></li>', get_permalink(), get_the_title(), $img );
}
endwhile;
echo '</ul>';
endif;
wp_reset_query();
}
shireman_books_header_loop();
echo '</div><!-- end .book-area -->';
}
elseif ( is_page(2023) ) { // Kids Books Page
echo '<div class="book-area">';
function shireman_books_header_loop() {
global $post;
$args = array(
'orderby' => 'rand',
'post_type' => 'we_published-book',
'posts_per_page' => 9,
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'we_book-category',
'field' => 'id',
'terms' => array( 55 ),
)
)
);
$bookthumbs = new WP_Query( $args );
if ( $bookthumbs->have_posts() ) :
echo '<ul>';
while ( $bookthumbs->have_posts() ) : $bookthumbs->the_post();
$img = genesis_get_image( array( 'format' => 'html', 'size' => 'book-small' ) );
if(has_post_thumbnail()) {
printf( '<li><a href="%s" title="%s"><span class="roll" ></span>%s</a></li>', get_permalink(), get_the_title(), $img );
}
endwhile;
echo '</ul>';
endif;
wp_reset_query();
}
shireman_books_header_loop();
echo '</div><!-- end .book-area -->';
}
elseif ( is_page(8) ) { // Novels Page
echo '<div class="book-area">';
function shireman_books_header_loop() {
global $post;
$args = array(
'meta_key' => 'header_order',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'post_type' => 'we_published-book',
'posts_per_page' => 9,
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'we_book-category',
'field' => 'id',
'terms' => array( 54 ),
)
)
);
$bookthumbs = new WP_Query( $args );
if ( $bookthumbs->have_posts() ) :
echo '<ul>';
while ( $bookthumbs->have_posts() ) : $bookthumbs->the_post();
$img = genesis_get_image( array( 'format' => 'html', 'size' => 'book-small' ) );
if(has_post_thumbnail()) {
printf( '<li><a href="%s" title="%s"><span class="roll" ></span>%s</a></li>', get_permalink(), get_the_title(), $img );
}
endwhile;
echo '</ul>';
endif;
wp_reset_query();
}
shireman_books_header_loop();
echo '</div><!-- end .book-area -->';
}
elseif ( is_page(2166) ) { // Non Fiction Page
echo '<div class="book-area">';
function shireman_books_header_loop() {
global $post;
$args = array(
'meta_key' => 'nonfiction_header_order',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'post_type' => 'we_published-book',
'posts_per_page' => 9,
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'we_book-category',
'field' => 'id',
'terms' => array( 79 ),
)
)
);
$bookthumbs = new WP_Query( $args );
if ( $bookthumbs->have_posts() ) :
echo '<ul>';
while ( $bookthumbs->have_posts() ) : $bookthumbs->the_post();
$img = genesis_get_image( array( 'format' => 'html', 'size' => 'book-small' ) );
if(has_post_thumbnail()) {
printf( '<li><a href="%s" title="%s"><span class="roll" ></span>%s</a></li>', get_permalink(), get_the_title(), $img );
}
endwhile;
echo '</ul>';
endif;
wp_reset_query();
}
shireman_books_header_loop();
echo '</div><!-- end .book-area -->';
}
elseif ( is_page(2025) ) { // Indie Chicks Books Page
echo '<div class="book-area">';
function shireman_books_header_loop() {
global $post;
$args = array(
'orderby' => 'rand',
'post_type' => 'we_published-book',
'posts_per_page' => 9,
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'we_book-category',
'field' => 'id',
'terms' => array( 56 ),
)
)
);
$bookthumbs = new WP_Query( $args );
if ( $bookthumbs->have_posts() ) :
echo '<ul>';
while ( $bookthumbs->have_posts() ) : $bookthumbs->the_post();
$img = genesis_get_image( array( 'format' => 'html', 'size' => 'book-small' ) );
if(has_post_thumbnail()) {
printf( '<li><a href="%s" title="%s"><span class="roll" ></span>%s</a></li>', get_permalink(), get_the_title(), $img );
}
endwhile;
echo '</ul>';
endif;
wp_reset_query();
}
shireman_books_header_loop();
echo '</div><!-- end .book-area -->';
}
elseif ( is_archive() || is_page() || is_single() ) {
echo '<div class="book-area">';
function shireman_books_header_loop() {
global $post;
$args = array(
'orderby' => 'rand',
'post_type' => 'we_published-book',
'posts_per_page' => 9,
'post_status' => 'publish',
);
$bookthumbs = new WP_Query( $args );
if ( $bookthumbs->have_posts() ) :
echo '<ul>';
while ( $bookthumbs->have_posts() ) : $bookthumbs->the_post();
$img = genesis_get_image( array( 'format' => 'html', 'size' => 'book-small' ) );
if(has_post_thumbnail()) {
printf( '<li><a href="%s" title="%s"><span class="roll" ></span>%s</a></li>', get_permalink(), get_the_title(), $img );
}
endwhile;
echo '</ul>';
endif;
wp_reset_query();
}
shireman_books_header_loop();
echo '</div><!-- end .book-area -->';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment