WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] the_tag and raw text? (5 posts)

  1. OperaManiac
    Member
    Posted 6 years ago #

    could not find it on the codex. can i get the_tag code to generate raw text seperated by commas? like

    wordpress, bbpress, akismet

    no html, just plain text.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    There is no such code presently. Tags are linked to something. That's part of what makes them Tags. If they're not links, then they're not recognized as tags anymore by automated parsers.

    But, this will do it in the Loop:
    <?php echo strip_tags(get_the_tags('',', ','')); ?>

  3. OperaManiac
    Member
    Posted 6 years ago #

    thanks. i needed the tags to be put in meta tags so did not need the links in them :)

    update: umm any ways to get them outside the loop?

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    update: umm any ways to get them outside the loop?

    No. Create an extra Loop for getting them instead. Like in your header.php:

    <?php if (is_single()) { the_post(); rewind_posts(); ?>
    <meta whatever="<?php echo strip_tags(get_the_tags('',', ','')); ?>" />
    <?php } // end extra Loop ?>
  5. OperaManiac
    Member
    Posted 6 years ago #

    cool thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.