Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: Cooking Tips
- */
- //Ref link: http://codex.wordpress.org/Function_Reference/have_posts
- //Pastebin link: http://pastebin.com/mkvhYwXU
- remove_action( 'genesis_post_title','genesis_do_post_title' ); // Removes post title
- remove_action( 'genesis_loop', 'genesis_do_loop' );
- add_action( 'genesis_loop', 'cooking_tips_archives' );
- ?>
- <?php
- function cooking_tips_post_image() {
- if ( ! is_singular() && genesis_get_option( 'content_archive_thumbnail' ) ) {
- $img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'attr' => array( 'class' => 'alignleft post-image' ) ) );
- printf( '<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), $img );
- }
- }
- function cooking_tips_archives() {
- query_posts( array ( 'category_name' => 'cooking-tips', 'posts_per_page' => '-1' ) );
- if (have_posts()) :
- $i=0; // counter
- while (have_posts()) : the_post(); ?>
- <?php if ($i <= 2) { ?>
- <div class="post type-post hentry">
- <h2 class="entry-title"><a href="<?php echo get_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
- <div class="entry-content">
- <?php cooking_tips_post_image(); ?>
- <?php the_excerpt(); ?>
- <a class="more-link" href="<?php the_permalink(); ?>" alt="<?php the_title(); ?>" >Read more...</a>
- </div><!-- .entry-content -->
- </div><!-- .post -->
- <?php }; ?>
- <?php if ($i == 3) { ?>
- <div id="post type-post hentry">
- <h2 class="entry-title"><a href="<?php echo get_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
- <?php cooking_tips_post_image(); ?>
- <div id="accordion-archive">
- <?php $shrt_cd = "[accordion title='More Cooking Tips from A Well-Seasoned Kitchen']";
- $query = new WP_Query( array ( 'category_name' => 'cooking-tips', 'offset' => '3' ) );
- $shrt_cd .= '<ul class="accordion-archive-list">';
- while (have_posts()) : the_post();
- $shrt_cd .= '<li><a href="'.get_permalink().'">';
- $shrt_cd .= get_the_title();
- $shrt_cd .= '</a></li>';
- endwhile;
- $shrt_cd .= '</ul>';
- $shrt_cd .= "[/accordion]";
- echo do_shortcode( $shrt_cd );
- wp_reset_query();
- ?>
- </div><!-- .entry-content -->
- </div><!-- accordion-archive -->
- <?php return $wp_query->current_post + 1 < $wp_query->post_count;?>
- <?php }; ?>
- <?php $i++; ?>
- <?php endwhile; ?>
- <?php endif; ?>
- <?php
- }
- genesis();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement