dislpaying featured posts with title in header (1 post)

  1. anuragupadhaya
    Posted 7 years ago #

    NOTE: i didn't find any satisfactory link for this thing on web.
    i am trying to include header of sites like wired.com or lifehacker.com, but with a minimal theme in my blog.
    But i didn't find any satisfactory code on internet. Any designer would help me anyhow??

    I am trying to include featured posts with titles in the header of my theme.

    this is the code:

    <div id="featured">
    	<ul id="carousel">
    		$featured_posts = get_posts('numberposts=3&amp;category=1');
    		foreach( $featured_posts as $post ) {
    			$custom_image = get_post_custom_values('featured_image', $post->ID);
    			$image = $custom_image[0] ? $custom_image[0] : get_bloginfo("template_directory")."/images/no-featured-image.jpg";
    			printf('<li><a href="%s" title="%s"><img src="%s" alt="%s" /></a></li>', get_permalink($post->ID), $post->post_title, $image, $post->post_title);
    	<div class="clear"></div>

    With this code the images of featured posts are showing up but not the title with link. what should i do for that??

Topic Closed

This topic has been closed to new replies.

About this Topic