Forums

[resolved] How to get only last ten post on homepage (3 posts)

  1. orha
    Member
    Posted 2 years ago #

    This is my homepage code, right now hompage include only 10 post from one category, they are just summery too. I need full last ten post at homepage. What should I do to have them. Tnx

    <?php get_header(); ?>
    
    <div id="content">
    
    <div id="contentleft">
    <div class="postarea">
    
    	<div id="homepagebottom">
    
    			<div class="hpbottom">
    			<h3><?php echo cat_id_to_name(get_theme_mod('featured_bottom')); ?></h3>
    
    				<?php $recent = new WP_Query("cat=".get_theme_mod('featured_bottom')."&showposts=".get_theme_mod('featured_bottom_num')); while($recent->have_posts()) : $recent->the_post();?>
    				<?php if( get_post_meta($post->ID, "thumb", true) ): ?>
    				<a href="<?php the_permalink() ?>" rel="bookmark"><img class="thumb" src="<?php bloginfo('template_directory'); ?>/tools/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&h=<?php echo get_theme_mod('featured_bottom_thumb_height'); ?>&w=<?php echo get_theme_mod('featured_bottom_thumb_width'); ?>&zc=1" alt="<?php the_title(); ?>" /></a>
    				<?php else: ?>
    				<?php endif; ?>				
    
                    <strong><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></strong>
    				<?php the_content_limit(350, __("[Read more of this review]", 'studiopress')); ?>
    
    				<hr/>
    
    				<?php endwhile; ?>
    
    				<?php $cat = get_category(get_theme_mod('featured_bottom')); ?>
    				<strong><a href="<?php echo get_category_link(get_theme_mod('featured_bottom')); ?>" rel="bookmark"><?php echo __("Read More Posts From ", 'studiopress')." ".$cat->name; ?></a></strong>
    
    			</div>
    
    		</div>
    
    </div>
    
    <?php include(TEMPLATEPATH."/sidebar.php");?>
    
    </div>
    
    <?php // The main column ends  ?>
    
    <?php get_footer(); ?>

    This is home.php I have home.php and index.php?

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Will assume this is the right template, and take a guess at this---

    change this

    <?php $recent = new WP_Query("cat=".get_theme_mod('featured_bottom')."&showposts=".get_theme_mod('featured_bottom_num'));

    to

    <?php $recent = new WP_Query("showposts=".get_theme_mod('featured_bottom_num'));

    and change this:

    <?php the_content_limit(350, __("[Read more of this review]", 'studiopress')); ?>

    to

    <?php the_content(); ?>

    Make a copy before changing your theme!!

    Review template tags, query_posts(), and the_content(),

  3. orha
    Member
    Posted 2 years ago #

    Thank you :D

    I have some problem with style, but I will handle it.

    cheers

Topic Closed

This topic has been closed to new replies.

About this Topic