Forums

Display Tags, but not as a link (4 posts)

  1. fletchy182
    Member
    Posted 2 years ago #

    Hey guys,

    For SEO reasons I want to display post tags, but not actually as links, just as text. Might sound strange but I promise you my reasons are sound. Can you advise what I would do to remove the links from my tags?

    Thanks,

    Adam

  2. Edward Caissie
    Member
    Posted 2 years ago #

    Take a look at this page, the first usage example looks like what you are asking for: http://codex.wordpress.org/Function_Reference/get_the_tags

  3. fletchy182
    Member
    Posted 2 years ago #

    Nope that didn't fix it. Any other ideas? Thanks for your help.

  4. MichaelH
    Volunteer
    Posted 2 years ago #

    I believe get_the_tags works when in The Loop. Might need something like this outside The Loop.

    <?php
    $taxonomy = 'post_tag';
    $title = 'Tag: ';
    $args ='';
    $terms = get_terms( $taxonomy, $args );
    if ($terms) {
    foreach($terms as $term) {
    echo '<p>' . $term->name . '</p>';
    //echo '<p>' . $title . '<a href="' . get_term_link( $term->term_id, $taxonomy ) . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name.'</a> has ' . $term->count . ' post(s). </p> ';
    }
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags