• I want to replace the category slugs (the hyperlink text with the category title) with custom images. This shouldn’t be so hard, but I can’t find the right php to edit, or where that piece of information is, probably just easy as replacing text with an <img source…/>

Viewing 1 replies (of 1 total)
  • In WordPress nomenclature, a ‘category slug’ is just the category’s name encoded for use in an url (i.e. My Thoughts => my-thoughts). Thought I’d clear that up.

    If this is for category links displayed in a post with the_category() tag, instead of editing and maintaining changes to the source code, you may want to recreate that tag’s functionality with some custom PHP:

    <?php
    $categories = get_the_category();
    foreach($categories as $category) {
    echo '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), convert_chars($category->cat_name)) . '"><img src="/images/' . $category->category_nicename . '.jpg" /></a>';
    }
    ?>

Viewing 1 replies (of 1 total)

The topic ‘Replace category slugs with images’ is closed to new replies.