WordPress.org

Ready to get started?Download WordPress

Forums

How to make custom front page section for sticky post? (1 post)

  1. laureninspace
    Member
    Posted 5 months ago #

    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(); ?>

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 5 months ago by laureninspace
  • This topic is not resolved
  • WordPress version: 3.8.1