WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Output Standard Text When Post Tags Are Empty

[Resolved] Output Standard Text When Post Tags Are Empty

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael

    @alchymyth

    Forum Moderator

    <?php if( get_the_tags() ) { ?>
    <p class="tags"><?php the_tags('Tags: ', ' | ', ''); ?></p>
    <?php } else { ?>
    <p class="tags">No Tags Found</p>
    <?php } ?>

    http://codex.wordpress.org/Function_Reference/get_the_tags

    gartlans

    @gartlans

    Thanks Alchymyth that’s perfect!!! 🙂 Thanks for taking the time to share your knowledge, I appreciate it…

    This is a quick fix, but if you want to do it at the root of the categories file, you need to open wp-includes/category-template.php

    Line: 536

    You’ll find this:

    if ( empty( $tags ) || is_wp_error( $tags ) )
    		return;

    Replace with this and customize your text to taste:

    if ( empty( $tags ) || is_wp_error( $tags ) ) {
    		echo "<p>There are currently no associated tags.</p>";
    		return;
    	}
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Output Standard Text When Post Tags Are Empty’ is closed to new replies.
Skip to toolbar