• Hi there,

    I want the Post thumbnails to link to the a specific Children category. For example I have:

    Rock
    –Blues
    –LiteRock
    –HeavyRock

    And the post have been assigned to both Rock and ONE of the three children category (for example LiteRock).

    I’m currently using this:

    <?php foreach( ( get_the_category() ) as $categoryz) { $categoryz->cat_name . ' '; } ?>
    
    <a href="<?php echo get_category_link(get_cat_id($categoryz->cat_name)); ?>">
    <img ... />
    </a>

    And it works, but I actually find that WordPress choose alphabetically the one that comes later, and so Rock comes after LiteRock.

    So I have the link for the Rock parent category. Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to link Children categories?’ is closed to new replies.