MetaTags. Version: 0.6 Author: GNot Author URI: http://www.g-loaded.eu/ */ /* License: GPLv2 Compatibility: All What it does: Adds the post's categories and excerpt to the "keywords" and the "description" XHTML meta tags respectively, while viewing single posts. It also adds the blog's description and categories to the "description" and the "keywords" meta tags respectively on the home page. Installation: Put the add-meta-tags.php file in your /wp-content/plugins/ directory and activate through the administration panel. Copyright (C) George Notaras (http://www.g-loaded.eu/) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Changelog * Wed Jan 10 2007 - v0.6 - A description filter was added. Double quotes and other special characters are are now transformed to HTML entities. Also, line-feed characters and multiple consecutive empty spaces are replaced by a single empty space. Thanks to Ronald for the bug report. * Tue Nov 28 2006 - v0.5 - Added ability to override the keywords that derives from the post's categories with custom keywords from a custom field, named "keywords". (for single posts) - When overriding keywords, %cats% is replaced with the post's categories. - Added ability to override the description that derives from post's excerpt with a custom description from a custom field, named "description". (for single posts) - Added administration panel. No more manual editing. * Sun Nov 05 2006 - v0.4 - The plugin also adds "description" and "keywords" meta tags on the home page. * Wed Oct 04 2006 - v0.3 - Plugin information update * Fri Jan 6 2006 - v0.2 - Duh! I had forgotten to strip the tags from the excerpt. Now it's fixed. * Thu Jan 5 2006 - v0.1 - Initial release */ // Admin Panel function amt_add_pages() { add_options_page('Meta Tags Options', 'Meta Tags', 8, __FILE__, 'amt_options_page'); } function amt_options_page() { if (isset($_POST['info_update'])) { // Site description option if (empty($_POST['amt_site_description'])) { // Delete the option from the DB if it's empty delete_option('amt_site_description'); $msg_desc = "Site description deleted from the WordPress database."; } else { $site_description = $_POST['amt_site_description']; update_option('amt_site_description', $site_description); $msg_desc = "Site description saved."; } // Site keywords option if (empty($_POST['amt_site_keywords'])) { // Delete the option from the DB if it's empty delete_option('amt_site_keywords'); $msg_keyw = "Site keywords deleted from the WordPress database."; } else { $site_keywords = $_POST['amt_site_keywords']; update_option('amt_site_keywords', $site_keywords); $msg_keyw = "Site keywords saved."; } _e('
' . $msg_desc . '
' . $msg_keyw . '
The options in this section can be used in order to override the default behaviour of the "Add-Meta-Tags" plugin, when it writes the "description" and "keywords" meta tags for the blog\'s front page. Modifying the following settings is completely optional.
Although no configuration is needed in order to put meta tags on single posts, the following information will help you customize them.
By default, when a single post is displayed, the post\'s excerpt and the post\'s categories are used in the "description" and the "keywords" meta tags respectively.
It is possible to override them by providing a custom description in a custom field named "description" and a custom comma-delimited list of keywords by providing it in a custom field named "keywords".
Furthermore, when overriding the post\'s keywords, but you need to include the post\'s categories too, you don\'t need to type them, but the tag %cats% can be used.
Example: keyword1, keyword2, %cats%, keyword3, keyword4