Forums

List Post Titles as links (6 posts)

  1. jimmyt1988
    Member
    Posted 2 years ago #

    Hi all,

    I have set up a page where I would like the posts that I create to be accessed via a link down the left hand side of my website.

    The link text would be the titles of the posts.

    So for example, If I create 2 posts. One is called: hi, the other is called: bye.

    I want those two posts as links down the left handside:

    Hi
    Bye

    And when you click on these links, it shows the content of that post (blog).

    How do I go about doing this.

    Something like this:
    <?php wp_get_archives('postbypost&limit=15'); ?>
    But rather than the archive date being a link to a list of uncategorised blog entries, I want the blog entries to be the list down the side.

    Hope I explained enough.

    Mega look forward to your responses!

  2. alchymyth
    The Sweeper
    Posted 2 years ago #

    did you have a look at the 'recent posts' widget, which does something similar?

    otherwise, you could build a mini loop to show just the linked titles of the posts.

  3. jimmyt1988
    Member
    Posted 2 years ago #

    The second sounds more yummy.

    Any chance you could give me an example in which I can learn from?

  4. alchymyth
    The Sweeper
    Posted 2 years ago #

    http://codex.wordpress.org/The_Loop_in_Action
    http://codex.wordpress.org/Function_Reference/query_posts

    using an unordered list for instance:

    <ul>
    <?php
    query_posts('cat=0$posts_per_page=-1'); // query to show all posts independant from what is in the center;
    if (have_posts()) :
       while (have_posts()) :
          the_post(); ?>
    <li>
          <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    </li>
    <?php  endwhile;
    endif;
    wp_reset_query();
    ?>
    </ul>

    this should give you a list of all posts, linked to each individual post.

  5. jimmyt1988
    Member
    Posted 2 years ago #

    If(the function have_posts returns true){ then
    while (the function that is asking if there are any posts is true){
    echo the function that has the post information;
    wrap link around the function that returns just the title of the function that has the information of each post;
    }
    }

    What does the wp_reset_query(); do?

    P.S it works and thankyou very much

  6. alchymyth
    The Sweeper
    Posted 2 years ago #

    What does the wp_reset_query(); do?

    it does what it says in the codex:
    http://codex.wordpress.org/Function_Reference/wp_reset_query

Topic Closed

This topic has been closed to new replies.

About this Topic