Title: post icon custom post type
Last modified: August 19, 2016

---

# post icon custom post type

 *  Resolved [zeaks](https://wordpress.org/support/users/zeaks/)
 * (@zeaks)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-icon-custom-post-type/)
 * Is it possible to have an image show next to the post title by using a custom
   post type? I want to be able to set an image next to the post title for certain
   posts, with the ability to remove it later if I want. I know there’s plugins 
   like category icons, but they won’t do what I need.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-icon-custom-post-type/#post-1906461)
 * Using a CPT just to display an icon is a bit overkill. CPTs have a purpose. You’d
   run into a lot of other issues using the CPT. They don’t by default appear in
   RSS, they don’t show up in your normal post flow without special queries, etc.
   You can definitely do what you are asking, just not sure it its the best way.
 * Something like a custom field might be far simpler
    [http://codex.wordpress.org/Custom_Fields](http://codex.wordpress.org/Custom_Fields)
 * You could have a custom field with a key of icon and a value of the url to the
   icon…. something like that….
 * This is a general suggestion based on the info given… maybe you are looking for
   a bit more that I haven’t understood….
 *  Thread Starter [zeaks](https://wordpress.org/support/users/zeaks/)
 * (@zeaks)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-icon-custom-post-type/#post-1906516)
 * I actually meant custom post field. I don’t know anything about custom post types.
   
   I know how to do what the codex says with adding a text or image to the post 
   body, but I don’t know how to do anything with it as far as a post title goes,
   and can’t find any examples or info on it.
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-icon-custom-post-type/#post-1906518)
 * OK, well, say you enter the key as icon, and the value as the url…. that gets
   the info you need in place.
 * You can then include something like this in your template
 *     ```
       <?php if( get_post_meta($post->ID, "icon", true) ): ?>
       <img src="<?php echo get_post_meta($post->ID, "icon", true); ?>">
       <?php endif; ?>
       ```
   
 * Which basically says if there is a value associated with the icon custom field,
   use it as teh image source
 * That code would go near your title code. You could alter it a bit to add a class
   to help position the image, or to add in a title or whatever, but that’s the 
   basic….
 *  Thread Starter [zeaks](https://wordpress.org/support/users/zeaks/)
 * (@zeaks)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-icon-custom-post-type/#post-1906542)
 * Thanks alot, that worked, just need to adjust it like you said
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-icon-custom-post-type/#post-1906545)
 * Sure, and now you know how to output your custom fields, just like that! They’re
   pretty useful!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘post icon custom post type’ is closed to new replies.

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/post-icon-custom-post-type/#post-1906545)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
