• Resolved Ankit Rawat

    (@ankitrawat)


    Hi,
    My website is https://goo.gl/PJY0y
    I want to make it look like https://goo.gl/8GUoe

    Can someone help me and tell me how to List Last 5 Post from Every Category in Index.php like https://goo.gl/8GUoe

    My Index.php code:

    <?php error_reporting(0); get_header(); ?>
        <td>
    
    <table style="text-align:left;" width="900px" border="0" align="center">
    
            <tbody><tr class="style13">
      <?php if (have_posts()) : ?>
        <td width="8%" height="14" class="style13">&raquo; DATE</td>
    	  <td width="58%" class="style13">&raquo; DESCRIPTION</td>
    	  <td width="12%">&raquo; CATEGORY</td>
    	  <td width="12%">&raquo; TYPE</td>
    	  <td width="10%">&raquo; AUTHOR</td>
    	  </tr>
    
     	<?php while (have_posts()) : the_post(); ?>
      <tr class="submit">
        <td height="14" nowrap="nowrap" class="style14"><?php the_time('Y-m-d') ?></td>
        <td nowrap="nowrap"><a target="_blank" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></td>
        <td nowrap="nowrap"><?php the_category(', ') ?></td>
        <td nowrap="nowrap"><?php the_tags('', ', ', ''); ?></td>
        <td nowrap="nowrap"><?php coauthors_posts_links(); ?></td>
      </tr><?php endwhile; ?>
      </tr></tbody>
    
    </table>
    
    <div class="navigation">
    <?php if(function_exists('wp_pagenavi')) : ?>
         <?php wp_pagenavi() ?>
     	<?php else : ?>
    <?php next_posts_link(__('Next','fusion')) ?>
    <?php previous_posts_link(__('Back','fusion')) ?>
    <?php endif; ?>
    </div>
    <div>&nbsp;</div>
    
    <?php else : ?>
    
    	<h3>Not Found</h3>
    	<p>Sorry, but you are looking for something that isn't here.</p>
        <br /><br />
    
    <?php endif; ?>
    
    <div class="search">
    <?php get_search_form(); ?>
    </div>
    
     </center>
     </div>
    
    <?php get_footer(); ?>

    Please suggest me!
    Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter Ankit Rawat

    (@ankitrawat)

    Just an Update:

    I want to make it something like:

    <?php error_reporting(0); get_header(); ?>
        <td>
    
    <table style="text-align:left;" width="900px" border="0" align="center">
    
            <tbody><tr class="style13">
    
      <?php if (have_posts()) : ?>
        <td width="8%" height="14" class="style13">&raquo; DATE</td>
    	  <td width="58%" class="style13">&raquo; DESCRIPTION</td>
    	  <td width="12%">&raquo; CATEGORY</td>
    	  <td width="12%">&raquo; TYPE</td>
    	  <td width="10%">&raquo; AUTHOR</td>
    	  </tr>
          <?php query_posts('cat=4&showposts=5'); ?>
     	<?php while (have_posts()) : the_post(); ?>
      <tr class="submit">
        <td height="14" nowrap="nowrap" class="style14"><?php the_time('Y-m-d') ?></td>
        <td nowrap="nowrap"><a target="_blank" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></td>
        <td nowrap="nowrap"><?php the_category(', ') ?></td>
        <td nowrap="nowrap"><?php the_tags('', ', ', ''); ?></td>
        <td nowrap="nowrap"><?php coauthors_posts_links(); ?></td>
      </tr><?php endwhile; ?>
    
    <br></br><br></br>
    
      <?php if (have_posts()) : ?>
    
        <td width="8%" height="14" class="style13">&raquo; DATE</td>
    	  <td width="58%" class="style13">&raquo; DESCRIPTION</td>
    	  <td width="12%">&raquo; CATEGORY</td>
    	  <td width="12%">&raquo; TYPE</td>
    	  <td width="10%">&raquo; AUTHOR</td>
    	  </tr>
          <?php query_posts('cat=3&showposts=5'); ?>
     	<?php while (have_posts()) : the_post(); ?>
      <tr class="submit">
        <td height="14" nowrap="nowrap" class="style14"><?php the_time('Y-m-d') ?></td>
        <td nowrap="nowrap"><a target="_blank" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></td>
        <td nowrap="nowrap"><?php the_category(', ') ?></td>
        <td nowrap="nowrap"><?php the_tags('', ', ', ''); ?></td>
        <td nowrap="nowrap"><?php coauthors_posts_links(); ?></td>
      </tr><?php endwhile; ?>
      </tr></tbody>
    
    </table>
    
    <div class="navigation">
    <?php if(function_exists('wp_pagenavi')) : ?>
         <?php wp_pagenavi() ?>
     	<?php else : ?>
    <?php next_posts_link(__('Next','fusion')) ?>
    <?php previous_posts_link(__('Back','fusion')) ?>
    <?php endif; ?>
    </div>
    <div>&nbsp;</div>
    
    <?php else : ?>
    
    	<h3>Not Found</h3>
    	<p>Sorry, but you are looking for something that isn't here.</p>
        <br /><br />
    
    <?php endif; ?>
    
    <div class="search">
    <?php get_search_form(); ?>
    </div>
    
     </center>
     </div>
    
    <?php get_footer(); ?>

    But the above code is giving error .. ??

Viewing 1 replies (of 1 total)
  • The topic ‘How to List Last 5 Post from Every Category in Index.php’ is closed to new replies.