Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2. if(is_category()){
  3. global $wp_query;
  4.  
  5. if(isset($wp_query->posts) && !empty($wp_query->posts)) {
  6. $tags = array();
  7. foreach ($wp_query->posts as $post) {
  8. $posttags = get_the_tags($post->ID);
  9. if($posttags) {
  10. foreach ($posttags as $posttag) {
  11. $tags[] = $posttag->name;
  12. }
  13. }
  14. }
  15.  
  16. if(!empty($tags)) {
  17. $tags = array_unique($tags);
  18. $tags = implode(',',$tags);
  19. echo '<meta name="keywords" content="' . $tags . '" />';
  20. }
  21.  
  22. wp_reset_postdata();
  23. }
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement