• i want to put 5 0r 10 recent posts from specific categories on certain pages throughout my site.
    i have looked over the various topics for “recent posts” and while it seems that using archives is the best way, the only result i get from adding the code
    <?php get_archives('postbypost','20','html'); ? >
    to my side bar is a long list of all the entries in all the categories. how do i know what the ’20’ and ‘html’ additions mean in this application?
    how can i call all the posts from the archives in category 20 in the sidebar of a given page?
    is there a simple answer for this?
    please help.

Viewing 10 replies - 16 through 25 (of 25 total)
  • smbro

    (@smbro)

    what are the chances of this actually working on WP 1.5? i can’t get it to display anything witih WP 1.5 beta.

    j.

    smbro

    (@smbro)

    sorry didn’t read the instructions well enough–we use the category *id* and not category name. thanks,

    j.

    smbro

    (@smbro)

    actually — having trouble with this.

    when i call this without any more arguments than the post count, everything’s hunky dory (well, it works just like the get_archives/postbypost), but when i try to specify the category ID, the SQL it returns is valid (popped the SQL in and it returns the proper results), but the results do not display at all.

    j.

    pericat

    (@pericat)

    Which one are you having trouble with, smbro?

    smbro

    (@smbro)

    [whoa can’t believe bbPress doesn’t strip HTML! let’s try this post again–]

    https://www.coffee2code.com/archives/2004/08/27/plugin-customizable-post-listings/

    basically calling it as in the following example:

    c2c_get_recent_posts(3, “”,”34″);

    doesn’t work for me. funny thing is; i had it print the underlying SQL, and using the SQL, it *is* bringing back the proper posts from the category.

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    In your example you don’t define a format string; in essense, you’re telling the function not to display anything. Try adding a format string and see if it works:

    <ul>Recent Posts
    <?php c2c_get_recent_posts(3, "<li>%post_URL%<br />%post_date%</li>", "34"); ?>
    </ul>

    smbro

    (@smbro)

    thank you so kindly. makes perfect sense. ?? duh….works just fine.

    j.

    OK, I’m a total newbie to this WordPress stuff, I’ve spent days hacking about with php stuff to get my blog going at https://www.holster.co.uk/blog.

    I have catagories for books, films and music etc for when I write about something I’ve read or seen. I’d like to be able to do a recent posts by category, so I can have a “Last 3 books I read” link section etc etc. This thread seems to be asking the same thing, but is there a definative answer here? I don’t speak PHP!

    Help!

    ??

    Use the plugin linked to in the third post above yours, and then use the call posted by coffee2code above. Replace 34 with your cat ID#.

    That’s great, cheers Moshu & coffee2code, I couldn’t see my nose for my face there!

    ??

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘recent posts by category?’ is closed to new replies.