• Hello,

    I wish to use the tag system in wordpress for keywords for another element on my site.

    I plan on using the tags in php, so I need them to be “blank” ie, just the plain text.

    I managed to get the tags to show in plan text, by using the following code.

    <?php
    $posttags = get_the_tags();
    if ($posttags) {
    foreach($posttags as $tag) {
    echo $tag->name . ' ';
    }
    }
    ?>

    Would someone be able to tell me how to write the following..

    If tags exists…. show tags….. else, show post title

    I know it’s simple, but I can’t get the else part to work.

    Any help would be greatly appreciated.
    Cheers,
    Matt

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter ma2t

    (@ma2t)

    *bump* Any ideas people?
    Thanks

    I’m also interested in this, could somebody help?
    Thx.

    <?php if(function_exists('the_tags')): ?>
      <div class="tags"><?php the_tags('Tags: ', ', ', ''); ?></div>
      <?php endif; ?>

    Actually I don’t mind if tags are links too, so I used this code at last. Sorry, ma2t, it’s not ok for you, maybe helps to figure it out…

    Thread Starter ma2t

    (@ma2t)

    Thanks eszdan, I will give that code a try sometime, hopefuly I can just modify the code a little and add an Else somewhere lol.
    Cheers

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Tags with no Links, Simple If / Else statment?’ is closed to new replies.