How to make custom front page section for sticky post?
-
I’m customizing the bresponzive theme to replace the slider widget with a single sticky post. I’ve gotten it to echo back correctly, but for some reason, stickies are showing up only in the “recent posts” section.
I suspect that I didn’t correctly modify the loop to correspond with my sticky post code. Do you see an error in my main index template code?
<?php get_header(); ?> <!--#blocks-wrapper--> <div id="blocks-wrapper" class="clearfix"> <!--#blocks-left-or-right--> <div id="blocks-left" class="eleven columns clearfix"> <?php if(isset($bresponZive_tpcrn_data['offline_feat_slide'])) { if($bresponZive_tpcrn_data['offline_feat_slide'] =='1') include_once('includes/flex-slider.php'); }?> <?php $sticky = get_option('sticky_posts'); $not_in = array(); if ( $sticky ) { $args = array( 'posts_per_page' => 1, 'ignore_sticky_posts' => 1, 'post__in' => $sticky, ); $sticky_posts = get_posts($args); if ($sticky_posts) { foreach ($sticky_posts as $post) { setup_postdata($post); $not_in[] = $post->ID; echo "<h2>Sticky Post</h2><p>$post->ID ";the_title();echo '</p>'; } } } wp_reset_postdata(); ?> <h2 class="blogpost-wrapper-title"><?php _e('Recent Posts','bresponZive');?> </h2> <?php get_template_part( 'includes/blog', 'loop' );?> <!--homepage content--> <?php dynamic_sidebar('Magazine Style Widgets)'); ?> </div> <!-- /blocks col --> <?php get_sidebar(); ?> <?php get_footer(); ?>
- The topic ‘How to make custom front page section for sticky post?’ is closed to new replies.