Skip to content

Instantly share code, notes, and snippets.

@anneallen
Created April 21, 2015 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anneallen/4e9418d0b1a59459f3c0 to your computer and use it in GitHub Desktop.
Save anneallen/4e9418d0b1a59459f3c0 to your computer and use it in GitHub Desktop.
Using Boostrap Toggle in WordPress Custom Post Archive
remove_action('genesis_loop','genesis_do_loop');
add_action('genesis_loop','child_shopping_loop');
add_action( 'wp_enqueue_scripts', 'bootstrap_enqueue_scripts' );
function child_shopping_loop() {
$recent = new WP_Query(array(
'post_type' => array( 'shopping'),
'orderby' => 'date',
'order'=> 'DESC',
'posts_per_page'=> -1,
));
while ($recent->have_posts()) : $recent->the_post();
$return_string .='<div class="attr-entry entry">
<div class="one-fourth first">'.
genesis_get_image( array(
'size' => 'full',
'attr' => array (
'class' => 'aligncenter'
) ) ).
'</div>
<div class="three-fourths">
<a class="toggle attr-toggle arrow-closed" data-toggle="collapse" data-target="#attr-desc-'.get_the_ID().'">More Info</a>
<h2><a href="'.get_permalink().'" title="'.get_the_title().'">'.get_the_title().'</a></h2>'.
get_the_excerpt().'
</div>
<div id="attr-desc-'.get_the_ID().'" class="attr-desc collapse" style="height: auto;">'
.wpautop(get_the_content()).'
</div>
</div>';
endwhile;
echo $return_string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment