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
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
(@zeaks)
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.
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
(@zeaks)
Thanks alot, that worked, just need to adjust it like you said
Sure, and now you know how to output your custom fields, just like that! They’re pretty useful!