WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Help getting get_category_by_slug to work please!

[Resolved] Help getting get_category_by_slug to work please!

  • Hello,

    I’m trying to assign a little image icon to a post to represent the category it’s in, rather than using the category name. I figured the best way to do this would be to include the slug name in the filename of the image and call the slug in dynamically in category.php:

    <img class="valign-middle" src="images/icon-<?php get_category_by_slug( $slug ) ?>-small.png" />

    However, in Firebug all it’s showing is icon–small.png.

    Can anyone please explain to me where I’m going wrong? I’ve tried searching through the other related threads for this but most of them seem outdated or slightly different to what I’m after.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Help getting get_category_by_slug to work please!’ is closed to new replies.
Skip to toolbar