• this is my code, please help my website is https://www.pimpanime.com and i need all the recent posts to disappear looks really tacky like that i just want the 1 post at the top and only 1 category to appear on front page like site-news or updates and information ect.

    <?php get_header(); ?>
    
    <div id="content">
    <?php include (TEMPLATEPATH . '/slide.php'); ?>	
    
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <div class="box <?php if (++$counter % 2 == 0) { echo "last"; }?>" id="post-<?php the_ID(); ?>" id="post-<?php the_ID(); ?>">
    
    <div class="boxtitle">
    		<h2><a>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    <div class="data">
    	<span class="clock"> On <?php the_time('F - j - Y'); ?></span>
     		<span class="comm"><?php comments_popup_link('0 Comment', '1 Comment', '% Comments'); ?></span>
    </div>	
    
    </div>
    
    <div class="cover">
    	<div class="entry">
    	<?php cldb_home_image();?>
    		<?php the_excerpt(); ?>
    <div class="clear"></div>
    	</div>
    </div>
    
    </div>
    
    <?php endwhile; ?>
    
    <div class="clear"></div>
    
    <div id="navigation">
    <?php if(function_exists('wp_pagenavi')) : ?>
    <?php wp_pagenavi() ?>
    <?php else : ?>
            <div class="alignleft"><?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?></div>
            <div class="clear"></div>
    <?php endif; ?>
    
    </div>
    
    <?php else : ?>
    		<h1 class="title">Not Found</h1>
    		<p>Sorry, but you are looking for something that isn't here.</p>
    <?php endif; ?>
    
    </div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]

Viewing 6 replies - 1 through 6 (of 6 total)
  • @9tailedfox0531
    you can be used this code to display a single post & category in your template.

    display a single post:

    <?php
             $abc = query_posts(array('posts_per_page' => 1,'paged' => get_query_var('paged')) );
    
    ?>

    and display a single category (include the category id in this code):

    <?php wp_list_categories('include=3&title_li='); ?>

    you can follow this link.

    Thread Starter 9tailedfox0531

    (@9tailedfox0531)

    where in my code would i post this what should my index look like

    you want to display a particular category post on your site.

    Thread Starter 9tailedfox0531

    (@9tailedfox0531)

    i just want the feed of 1 category to go on home page, all other categories excperted

    You have to add this code after this <div id=”content”> in your code.:

    <?php
        $a = query_posts(array(
                                     'cat' => 3,  //edit here the category id
                                     'posts_per_page' => 1,
                                     'paged' => get_query_var('paged'))
                             );
    ?>

    Thread Starter 9tailedfox0531

    (@9tailedfox0531)

    Thank you that worked perfectly Please close topic.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Make Homepage display only posts from a single category’ is closed to new replies.