[Wordpress] Modificare plugin add-meta-tags
-
Come da titolo, ho aggiunto il plugin add-meta-tags, mi piace pero' come inserisce la description, ma non come inserisce le keywords, per questo secondo tag, ho aggiunto un'altro plugin, ora pero' mi trovo con un doppio tag keywords.
Puo' creare problemi?In caso affermativo, come posso modificare il plugin per fargli generare solo il meta tag description?
Questo e' il plugin:
<?php /* Plugin Name: Add Meta Tags Plugin URI: http://www.raoul.shacknet.nu/2006/01/05/add-meta-tags-wordpress-plugin/ Description: Adds the post's categories and excerpt to the keywords and the description XHTML meta tags respectively, while viewing single posts. Version: 0.2 Author: Raoul Author URI: http://www.raoul.shacknet.nu/ */ /* License: GPL Compatibility: All Installation: Place the add-meta-tags.php file in your /wp-content/plugins/ directory and activate through the administration panel. */ /* Copyright (C) Raoul (http://www.raoul.shacknet.nu/) 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 * 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 */ function amt_add_meta_tags() { global $posts; if ( is_single() ) { // Description $my_metatags = "\n<meta name=\"description\" content=\"" . strip_tags(get_the_excerpt()) . "\" />"; // Keywords $my_metatags .= "\n<meta name=\"keywords\" content=\""; foreach((get_the_category($posts[0]->ID)) as $cat) { $my_metatags .= $cat->category_nicename . ', '; } $my_metatags = substr($my_metatags, 0, -2) . "\" />\n"; } echo $my_metatags; } add_action('wp_head', 'amt_add_meta_tags'); ?>Ciaooooo

-
-
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi
lasciavo l'ultima riga, ecco perche' non funzionava 