Ejemplo n.º 1
0
 /**
  * Output meta keywords, if any.
  */
 function wds_meta_keywords()
 {
     if (is_admin()) {
         return;
     }
     global $post;
     global $wds_options;
     $metakey = false;
     if (is_home() && 'posts' == get_option('show_on_front') && isset($wds_options['keywords-home'])) {
         $metakey = wds_replace_vars($wds_options['keywords-home'], (array) $post);
     } else {
         if (function_exists('is_shop') && is_shop() && function_exists('woocommerce_get_page_id')) {
             // WooCommerce shop page
             $post_id = woocommerce_get_page_id('shop');
             $metakey = wds_get_value('keywords', $post_id);
             $use_tags = wds_get_value('tags_to_keywords', $post_id);
             $metakey = $use_tags ? $this->_tags_to_keywords($metakey) : $metakey;
         } else {
             $metakey = is_singular() ? wds_get_value('keywords') : false;
             $use_tags = is_singular() ? wds_get_value('tags_to_keywords') : false;
             $metakey = $use_tags ? $this->_tags_to_keywords($metakey) : $metakey;
         }
     }
     if ($metakey) {
         echo "\t" . '<meta name="keywords" content="' . esc_attr(stripslashes($metakey)) . '" />' . "\n";
     }
     // News keywords
     $news_meta = is_singular() ? stripslashes(wds_get_value('news_keywords')) : false;
     $news_meta = trim(preg_replace('/\\s\\s+/', ' ', preg_replace('/[^-_,a-z0-9 ]/i', ' ', $news_meta)));
     if ($news_meta) {
         echo "\t" . '<meta name="news_keywords" content="' . esc_attr($news_meta) . '" />' . "\n";
     }
 }
 function wds_page_title($postid)
 {
     $post = get_post($postid);
     $fixed_title = wds_get_value('title', $post->ID);
     if ($fixed_title) {
         return $fixed_title;
     } else {
         global $wds_options;
         if (!empty($wds_options['title-' . $post->post_type])) {
             return wds_replace_vars($wds_options['title-' . $post->post_type], (array) $post);
         } else {
             return '';
         }
     }
 }