Forums

[resolved] How can i add a post from a specific categorie on my site? (2 posts)

  1. dennisv1982
    Member
    Posted 2 years ago #

    hi there all,

    i am editing a template i bought myself because i want it to have a different feature than available in the template

    http://www.totalgamer.nl

    if you scroll down a little under "nieuws", i want it to have posts from a single categorie and than displayed like this":

    post title
    >> here a small piece of the text from the post <<
    Read more (the link that goes to the actual post

    but i cant find and/or get the right code to work... the official template just shows a few of the latest videos but i dont want it there.. i just want plain text with a read more link from a specific categorie.

    i hope someone can help me out?

  2. dennisv1982
    Member
    Posted 2 years ago #

    fixed it myself:
    if other people need it, here ya go:

    <div id="content" class="narrowcolumn" role="main">
    
    	<?php if (have_posts()) : ?>
    <?php query_posts('category_name=nieuws&showposts=10'); ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    				<div class="entry">
    					<?php the_content('Lees Verder... &raquo;'); ?>
    				</div>
    
    				<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?><?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('Geen Reacties »', '1 Reactie »', '% Reacties »'); ?></p>
    			</div>
    
    		<?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Eerdere Berichten') ?></div>
    			<div class="alignright"><?php previous_posts_link('Nieuwe Berichten &raquo;') ?></div>
    		</div>
    
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php get_search_form(); ?>
    
    	<?php endif; ?>
    
    	</div>

Topic Closed

This topic has been closed to new replies.

About this Topic