WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] tags for lists and links in sidebar (3 posts)

  1. csleh
    Member
    Posted 7 years ago #

    I must be phrasing this entirely wrong -- search for hours today! If you could tell me the tags that would be WONDERFUL. Even a pointer to what to search on would be helpful.
    I have a sidebar and I need to list 3 or 4 specific posts, then have a read more link to the category page with the all the posts. What I need is the <php> tag wording for this sidebar list and link.
    If it makes any difference, it has to use the post id, as pretty or fake pretty urls don't work.

    THANK YOU!!!

  2. csleh
    Member
    Posted 7 years ago #

    OK, I moved on to another project and found most of my answer.
    How can I list only posts 21, 22, 23 and 24 -- all within one category -- in my sidebar? There are other posts but I need these specific 4 to always be the sidebar content.

  3. csleh
    Member
    Posted 7 years ago #

    Okay, had to get the "force category template" plug in. Then on the page had to do a loop for each post:
    '<?php query_posts('p=21'); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <h3><?php the_title(); ?></h3>
    <?php the_content(); ?>
    <?php endwhile; ?><?php endif; ?>'

    because it wouldn't allow me to enter p=21,22,23 etc.

    Now the page displays all posts in one category.

    One final note to self: had to use the same query for each post to put just a few on a sidebar, with a link 'a href="index.php?cat=5"' to show the complete category page.

    Why did I do this? Because I needed each post to be individually editable by the client (much easier for them) but show the complete posts on one page in multiple columns. The secondary sidebar shows just the top few, with a link to the page. Each post gives credit to sponsors in a different sponsorship category (but all the same Wordprss category).

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags