• Resolved DylanR

    (@dylanr)


    Hi all,

    I’m currently building a custom widget similar to the WP_Recent_Posts and I’m wondering if there’s a way to return the content of a post in the widget area?

    I can figure out how to get the title, date, category, ID, pretty much everything but the content.

    The idea here is that I have a category of posts that are simply images that I would like to display in my sidebar, but will be accessible by the editors of my site.
    A simple way of doing this seems to be making a widget that will return the most recent post in a certain category, but for this to work properly, I need it to display the image attached to the post

    I would be very grateful for any help y’all can give 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    I know WP_Recent_Posts runs the standard WP loop and all the usual template tags should work inside the loop, including the_content() and get_the_content(). If your widget does the same, I can’t imagine why one of these would not work.

    I suspect you’ve already been there though. If you don’t mind posting your widget code in pastebin.com and providing a link, someone may be able to spot a problem.

    Thread Starter DylanR

    (@dylanr)

    Hi there,

    Thanks for the reply, I was actually trying to find out what function I would use to call the content, seems like the_content() seemed to work!

    Thanks a bunch

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying post content in a widget’ is closed to new replies.