• I’m not really sure what to call what I’m looking for so I’m having trouble searching to see if it exists. But I’ll describe it:

    Basically I want a widget to go in the sidebar which takes the posts from a particular category and posts them into the sidebar. Basically a “Latest News” type of thing.

    I’m also going to be posting a lot of other miscellaneous things which aren’t as important so I want the “Latest News” category to stand out (hence being in the sidebar) while the other stuff just gets posted as normal.

    Does something like this exist?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Use any RSS solution to pull your own RSS feed, from a particular category. That way it is cached, not a constant hit on the database…

    -d

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    mySQL caches queries anyway with a proper setup. Shouldn’t be a big deal.

    Anyway, if you look in the widgets plugin, you’ll find a function called widget_recent_entries(). It has this line in it:
    $r = new WP_Query('showposts=10');
    Change that to something like this:
    $r = new WP_Query('showposts=10&cat=37');

    Only replace the “37” with your category number. You can also change the title of “Recent Posts” to something else if you like.

    Thread Starter siege911

    (@siege911)

    The Recent Entries only give the Title. I’d prefer to have the whole text.

    Is there a way to put an RSS feed out from a single category?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Okay then, change the widget so it displays the text of the post too.

    Find the line that says this:
    <li><a href="<?php the_permalink() ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?> </a></li>

    And change it to this:
    <li><a href="<?php the_permalink() ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?> </a><?php the_content(); ?></li>

    BTW, yes, you can get an RSS feed for just one category. If you’re using pretty permalinks, it’ll be something like this:
    http://example.com/blog/category/your-category/feed/

    Thread Starter siege911

    (@siege911)

    Edit: Nevermind. My mistake. I fixed it.

    I used the Recent Entries thing however, it doesn’t parse any of the bolding or italics. Is that fixable?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    What do you mean by “doesn’t parse”? I’m not sure what you’re talking about. Bolding and italics will come through just like anything else there.

    Thread Starter siege911

    (@siege911)

    Well they don’t come through. None of the formatting does. Even when I want two lines between the text (i.e. new paragraph as opposed to line break), it doesn’t come through.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Ummm… Are you using the_excerpt()? Or the_content()? Because yes, the_excerpt strips formatting. the_content doesn’t.

    Thread Starter siege911

    (@siege911)

    I think it’s something in the theme I’m using that strips it. I’ve tried some RSS feeds in a static page using the stylesheet from the them I’m using and if I include them in the post area, the formatting comes in fine. In the sidebar, it is all stripped.

    I’ll look into it more.

    Thread Starter siege911

    (@siege911)

    I found out the problem. Just fixed the CSS and it’s good to go. Thanks for all of your help.

    As I understand as of wordpress 2.3.3 there is no widgets plugin in the “plugin” directory, widgets are part of the WP. Could anybody let me know where to look for the widget_resent_entries() function?
    I’d like to use Otto42’s solution to pull posts from my news category (or any for that matter) and place it in a sidebar as a widget:

    Otto42 said above:
    “Anyway, if you look in the widgets plugin, you’ll find a function called widget_recent_entries(). It has this line in it:
    $r = new WP_Query(‘showposts=10’);
    Change that to something like this:
    $r = new WP_Query(‘showposts=10&cat=37’);

    Only replace the “37” with your category number. You can also change the title of “Recent Posts” to something else if you like. “

    Thank you in advance for any help,
    Monika

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Sidebar news widget?’ is closed to new replies.