• rudtek2

    (@rudtek2)


    I have a custom post type with custom categories. I’ve created a custom taxonomy page for the categories as well. I want to have a line of code that will say “we’re sorry we dont have any [categoryname] at the moment.”

    this error code would list the actual category name though. so if the user were on “product_category/topicals/” it would say “we’re sorry we dont have any topicals at the moment.”

    i put this code at the end of my lopp after the end while. but it’s AFTER my loop so it doesn’t show a category

    <?php
    endwhile;
    else :
    // If no content, include the "No posts found" error.
    echo "<h1 class='center'>We currently don't have any selection of this type available.</h1><p class='center'>Please check back soon!</p>";
    endif;
    ?>

    is there any way to do this?

The topic ‘adding category to "if no posts"’ is closed to new replies.