Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Jeroen on "Homepage doesn’t show a sticky post"

$
0
0

Hi,

I'm working with this piece of code to show the latest 4 posts of category-id 1 on my homepage.

<!-- Recent Blog Posts -->
<?php
//get post type ==> regular posts
        global $post;
        $args = array(
        'post_type' =>'post',
        'numberposts' => '4',
	'category' => '1'
        );
        $blog_posts = get_posts($args);
    ?>
    <?php if($blog_posts) { ?>
<section id="home-posts" class="clearfix">
            <h2 class="heading"><span>Laatste nieuws</h2>
            <?php
            $count=0;
            foreach($blog_posts as $post) : setup_postdata($post);
            $count++;
            //get fotoalbum thumbnail
            $feat_img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'grid-thumb');
            ?>
<article class="home-entry <?php if($count == '4') { echo 'remove-margin'; } if($count == '3') { echo ' responsive-clear'; } ?>">

<div class="home-entry-description">
                    <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo the_title(); ?></a></h3>
		<?php if ($feat_img) {  ?>
	                <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo $feat_img[0]; ?>" height="<?php echo $feat_img[2]; ?>" width="<?php echo $feat_img[1]; ?>" alt="<?php echo the_title(); ?>" /></a>
	                <?php } ?>  <?php echo excerpt('35'); ?>
                </div>
<!-- /home-entry-description -->
</article>
<!-- /home-entry-->
<?php
            if($count == '4') { echo '<div class="clear"></div>'; $count=0; }
            endforeach; ?>
</section>
<!-- /home-posts -->
<?php } ?>

Now i would like to make use of Sticky post, and have the sticky post shown at the far left of the latest post. I think i have tried all the options and suggestions published here: http://codex.wordpress.org/Sticky_Posts. But i guess I'm doing something wrong.

Could anyone help me with this?


Viewing all articles
Browse latest Browse all 8245

Trending Articles