Forums

Automatic Tags Based on Keywords (3 posts)

  1. noelgreen
    Member
    Posted 4 years ago #

    Anyone know of a way to automatically populate the tags field based on keywords typed in the article / keywords box?

    So you type in "picture" in the keywords box, and "photos, pics, pictures, camera" all pops up in the tags field.

    Thanks!

  2. bernard1980
    Member
    Posted 4 years ago #

    copy this code between the <head> tags of your layout header.php file..
    works great in 2.5

    <?php global $post;
    if( is_single() || is_page() ) :
    $tags = get_the_tags($post->ID);
    if($tags) :
    foreach($tags as $tag) :
    $sep = (empty($keywords)) ? '' : ', ';
    $keywords .= $sep . $tag->name;
    endforeach;
    ?>
    <meta name="keywords" content="<?php echo $keywords; ?>" />
    <?php
    endif;
    endif;
    ?>

  3. bernard1980
    Member
    Posted 4 years ago #

    oh ... just noticed ... this will set the words into the meta tags of the page 'meta keywords'coding which is not what you asked ...sorry ... however it's a great way to customize your meta keywords. I don't see another positve thing about adding a enormous list with words on your pages...it's not very pretty looking...
    With this code you can add your keywords without showing them on your site and this they get indexed by search engines :-)

Topic Closed

This topic has been closed to new replies.

About this Topic