version -->\n"; // keywords are always generated from the posts' keywords $keywords = $this->get_all_keywords(); if (is_single() || is_page()) { // the easiest part: a single post or page $description = trim(stripslashes(get_post_meta($post->ID, "description", true))); } else if (is_category()) { // here we can at least use the category description $category = get_the_category(); if (isset($category[0]->category_description)) { $description = trim(stripslashes($category[0]->category_description)); } } else if (is_home()){ // index page if (get_option('another_wordpress_meta_plugin_home_description')) { $description = stripslashes(get_option('another_wordpress_meta_plugin_home_description')); } else { $description = get_bloginfo('description'); } } if (isset ($description) && !empty($description)) { $meta_string = sprintf("", $description); } if (isset ($keywords) && !empty($keywords)) { if (isset ($meta_string) && !empty($meta_string)) { $meta_string .= "\n"; } $meta_string .= sprintf("\n", $keywords); } if ($meta_string != null) { echo $meta_string; echo "\n"; } else { echo "\n"; } } function get_all_keywords() { global $posts; if (is_array($posts)) { foreach ($posts as $post) { if ($post) { if (get_option('another_wordpress_meta_plugin_use_categories')) { $categories = get_the_category($post->ID); foreach ($categories as $category) { if (isset($keywords) && !empty($keywords)) { $keywords .= ','; } $keywords .= $category->cat_name; } } $keywords_a = $keywords_i = null; $description_a = $description_i = null; $id = $post->ID; $keywords_i = stripslashes(get_post_meta($post->ID, "keywords", true)); if (isset($keywords_i) && !empty($keywords_i)) { if (isset($keywords) && !empty($keywords)) { $keywords .= ','; } $keywords .= $keywords_i; } } } } return $this->get_unique_keywords($keywords); } function get_unique_keywords($keywords) { $keywords_ar = array_unique(explode(',', $keywords)); return implode(',', $keywords_ar); } function admin_menu() { add_submenu_page('options-general.php', __('Another Wordpress Meta Plugin'), __('Another Wordpress Meta Plugin'), 5, basename(dirname(__FILE__)), array($this, 'plugin_menu')); } function add_meta_tags_textinput() { global $post; $keywords = stripslashes(get_post_meta($post->ID, 'keywords', true)); $description = stripslashes(get_post_meta($post->ID, 'description', true)); ?>
| Meta Information (by Another Wordpress Meta Plugin) | |
|---|---|
here. ') ?>
All In One SEO pack for even easier Search Engine Optimization.'); ?>
main page / home page:') ?>