WordPress.org

Ready to get started?Download WordPress

Forums

Show Updated Post of Front Page (11 posts)

  1. cyberknight8610
    Member
    Posted 3 years ago #

    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?

  2. cyberknight8610
    Member
    Posted 3 years ago #

    Bump

  3. glrss
    Member
    Posted 3 years ago #

    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; ?>
  4. cyberknight8610
    Member
    Posted 3 years ago #

    Where do I put the code?

  5. glrss
    Member
    Posted 3 years ago #

    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; ?>
  6. cyberknight8610
    Member
    Posted 3 years ago #

    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.

  7. cyberknight8610
    Member
    Posted 3 years ago #

    Where do I place this code?

  8. esmi
    Forum Moderator
    Posted 3 years ago #

    Within your theme's index.php template file.

  9. cyberknight8610
    Member
    Posted 3 years ago #

    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(); ?>
  10. esmi
    Forum Moderator
    Posted 3 years ago #

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

  11. cyberknight8610
    Member
    Posted 3 years ago #

    it didn't work

Topic Closed

This topic has been closed to new replies.

About this Topic