WordPress.org

Ready to get started?Download WordPress

Forums

Get category title from recent post? (6 posts)

  1. thomasp423
    Member
    Posted 1 year ago #

    I'm using udesign theme.

    In the main home content widget area I would like to pull the category name of the post in its respective position in the bottom widget area.

    So let me explain, I have 4 links in main widget area. Then below I have 4 "latest post" areas that use a shortcode to display the post thumbnail, title, and text.

    I want position 1 in main widget area to be the category of the post 1 in the bottom widget area.

    I feel like it is pretty straight forward I just can't seem to figure it out!
    If I need to post any code let me know.

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    I'm sorry but as you are using a commercial theme, you need to seek support from the theme's vendors. We do not support commercial themes here.
    http://themeforest.net/user/internq7

  3. thomasp423
    Member
    Posted 1 year ago #

    But I feel as though $category is within wordpress' codex so this isn't really theme specific.

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    You can still use Codex's function references, but these forums simply don't support commercial themes.

  5. thomasp423
    Member
    Posted 1 year ago #

    Ok. So if I may revise my question,

    How can I call a category to pull the name of the category from a certain post based on the post ID?

  6. Andrew
    Forum Moderator
    Posted 1 year ago #

    Use get_post to grab your post (by the post ID) and use its returned post_category field.
    http://codex.wordpress.org/Function_Reference/get_post

    Then use get_cat_name to grab the category name via its ID.
    http://codex.wordpress.org/Function_Reference/get_cat_name

Topic Closed

This topic has been closed to new replies.

About this Topic