WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Display post categories on image attachment page (3 posts)

  1. busybe235
    Member
    Posted 1 year ago #

    I am working on a site which has posts mostly containing image galleries.
    As when writing a post, I assign some categories which are displayed in post entry-meta. When opening a post, images are displayed in list and open in attachment page. The problem is that I can't able to display post-categories on image attachment page i.e. image.php.
    Any help appreciated.
    Thanks

  2. alchymyth
    Forum Moderator
    Posted 1 year ago #

    you could use:

    <?php echo get_the_category_list( ', ','',$post->post_parent ); ?>

    http://codex.wordpress.org/Function_Reference/get_the_category_list

  3. busybe235
    Member
    Posted 1 year ago #

    Thanks Alchymyth., I was struggling with different functions.

Topic Closed

This topic has been closed to new replies.

About this Topic