WordPress.org

Ready to get started?Download WordPress

Forums

List Post Links from a Certain Category (9 posts)

  1. Member111
    Member
    Posted 5 years ago #

    Hello,

    I have a page called Resources and would like to display the links to the posts of the category articles only.

    How do I do this?

  2. SimonJ
    Member
    Posted 5 years ago #

    What do you mean?

    You created a "page" in wordpress, and on this page, you would like to display links to articles from a specific category?

    If this is what you mean :

    1- Make a page template
    http://codex.wordpress.org/Pages#Page_Templates

    2- In your template file, use this loop where you want to display the links :

    <?php query_posts('cat=5&showposts=5'); ?>
    <?php while (have_posts()) : the_post(); ?>
    ---DO YOUR STUFF (author, title, permalink, date, etc...)---
    <?php endwhile; ?>

    NOTE : In this example, we show 5 posts from category 5...(cat=5&showposts=5)

    3- Upload this template file in your theme directory

    4- Wp-admin -> edit page -> choose the page template you just created for your "ressource" page

    S.

  3. Member111
    Member
    Posted 5 years ago #

    Thank you.

    What do I call this page when I save it?

    Isn't there a plugin I could use?

    what I mean is:

    You know how we have pages on wordpress eg home page, which has recent posts, then I might have an about page, a contact page, and then I may also create a page called resources, and on that page I want to have a list of posts of a certain category. Like first maybe the category articles. Then after that in another part of the page have it from audio etc.

  4. SimonJ
    Member
    Posted 5 years ago #

    It seems to me that you don't understand what a wordpress "page" is.

    What you call "home page", where the recent post are displayed, is not a "page" that you created in wordpress. (wp-admin -> write page)

    This so called "home page" is generated by the loop in the index.php file located in your theme directory (or alternatively home.php). This is not really a "page" in the wordpress terminology.

    The "about" page and the "contact" page are some "page" that you created in wordpress, the ones that you see when you manage your "pages" in the dashboard.

    I really suggest you to read the codex about pages : http://codex.wordpress.org/Pages

    What I explained to you, is how to create a wordpress "page" to display posts from a category.

    For your question, you can name this page wathever you like. If the title of this page should be "ressources", then name it "ressources".

    S.

  5. Member111
    Member
    Posted 5 years ago #

    okay now I know there's a difference.

    thanks.

    There was a plugin but it isn't working for me.

  6. Member111
    Member
    Posted 5 years ago #

  7. JessieBirks
    Member
    Posted 5 years ago #

    I'm attempting to make a custom home page that will display some static content, along with excerpts from some of the most recent blog posts.

    I put a little bit of code into the page and I ran into a weird problem:
    http://www.opusbeta.com/

    Why am I getting that extra string of meta data at the top?

    I checked, and that meta data is being drawn from the page info. Strange, because other pages on the site don't display their own meta data.

    The code in the page content is (and this is the only content I put in this page):
    <?php query_posts('cat=2&showposts=1'); ?>

    I'm running 2.7.1 with the unmodified Atahualpa theme.

  8. most impressive
    Member
    Posted 4 years ago #

    The code above didn't work for me (on version 2.8.4), sorry simon. Instead, I used this and it worked:

    <?php query_posts('category_name=articles&showposts=5'); ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div class="post" 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>
    				<p><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></p>
    
    				<?php the_content('Read the rest of this entry &raquo;'); ?>
    
    				<p><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    			</div>
    
                <hr>
    
    		<?php endwhile; ?>

    The only thing I changed was using category_name=articles instead of cat=articles

  9. DeanH1
    Member
    Posted 4 years ago #

    Thanx: most impressive
    this worked super for me

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.