WordPress.org

Support

Support » How-To and Troubleshooting » Show Updated Post of Front Page

Show Updated Post of Front Page

  • I wan’t to make it where it will show the posts I updated on the front page and still have my new posts on these too. How can I do this?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Bump

    This works for me.

    <?php
    $modposts = get_posts('numberposts=6&orderby=modified');
    foreach($modposts as $post) :
    ?>
    <li<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>

    Where do I put the code?

    Mine’s in the sidebar. Put it where you want the list of recently modified posts to appear. I’ve noticed I deleted a > when posting the code. It should read:

    <?php
    $modposts = get_posts('numberposts=6&orderby=modified');
    foreach($modposts as $post) :
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>

    Sorry I don’t understand, where do I place the code so the updated and new posts appear on the main part of the home page.

    Where do I place this code?

    esmi

    @esmi

    Forum Moderator

    Within your theme’s index.php template file.

    where do I put it in this code?-

    <?php get_header(); ?>
    	<div id="wrap">
    	<!-- Main Content-->
    		<img src="<?php bloginfo('template_directory');?>/images/content-top.gif" alt="content top" class="content-wrap" />
    		<div id="content">
    			<!-- Start Main Window -->
    			<div id="main">
    
    				<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    					<?php include(TEMPLATEPATH . '/includes/entry.php'); ?>
    
    				<?php endwhile; ?>
    
    					<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
    					else { ?>
    						<?php include(TEMPLATEPATH . '/includes/navigation.php'); ?>
    					<?php } ?>
    
    				<?php else : ?>
    					<?php include(TEMPLATEPATH . '/includes/no-results.php'); ?>
    				<?php endif; ?>
    			</div>
    			<!-- End Main -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    esmi

    @esmi

    Forum Moderator

    Try adding the code just before <?php if (have_posts()).

    it didn’t work

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Show Updated Post of Front Page’ is closed to new replies.
Skip to toolbar