Display post tags as images (4 posts)

  1. Matt
    Posted 6 years ago #

    Hello everyone,

    I've got an idea, but coming up short on execution. I'd like to display the post TAGS, as images rather than text. Anyone think this is possible?

    The reason I want to do this, is probably only useful in a select few situations, but for me is simple. On my portfolio site (which is only local at this point) I would like to add tags to my posts like: CSS, HTML Photoshop etc. and then have those displayed as little icons rather than just text.

    Any bright ideas out there?

  2. Matt
    Posted 5 years ago #

    Bump.... anyone?

  3. Creatier
    Posted 5 years ago #

    Hi Matt,

    I did this a while back with a nice hack/workaround, not a problem.
    I assume that when your portfolio includes css, html and photoshop work you know how to edit a template.

    The function you are looking for is probably already in your template:
    <?php the_tags( $before, $separator, $after ); ?>

    create your icons inside your template_folder/images/icons/[tag_name].jpg/png/gif

    alter the the_tags $before, $separator and $after variables accordingly.

    Haven't tested it but should be something like this:

    <?php the_tags('<ul><li><img src="'.get_bloginfo("template_url").'/images/icons/','.jpg" /></li><li><img src="'.get_bloginfo("template_url").'/images/icons/','.jpg" /></li></ul>"); ?>

    In case the_tags() already auto-formats into a list, just use the <img />- part of the above code.

    Should at least kick you right in the right direction.
    Good luck:)

  4. Matt
    Posted 5 years ago #

    Ah! Brilliant. Great workaround, I'll give it a shot - I think this will work.


Topic Closed

This topic has been closed to new replies.

About this Topic