Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. CMS & Piattaforme Self-Hosted
  5. [Wordpress] Modificare plugin add-meta-tags

[Wordpress] Modificare plugin add-meta-tags

Pianificato Fissato Bloccato Spostato CMS & Piattaforme Self-Hosted
3 Post 2 Autori 1.5k Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • S
    S
    sawadee
    scritto su ultima modifica di
    User Attivo 0
    #1
    [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

    1 Risposta Ultima Risposta
    Miglior risposta 0
    0
    • T
      T
      tambu
      scritto su ultima modifica di
      Super User 42
      #2

      commenta tutto sto pezzo

      $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";

      1 Risposta Ultima Risposta
      Miglior risposta 0
      0
      • S
        S
        sawadee
        scritto su ultima modifica di
        User Attivo 0
        #3

        Grazieeee, ci stavo perdendo la testa lasciavo l'ultima riga, ecco perche' non funzionava 😄

        Ciaooooo

        1 Risposta Ultima Risposta
        Miglior risposta 0
        0

        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
        Rispondi
        • Risposta alla discussione
        Effettua l'accesso per rispondere
        • Da Vecchi a Nuovi
        • Da Nuovi a Vecchi
        • Più Voti


        • Accedi

        • Non hai un account? Registrati

        • Accedi o registrati per effettuare la ricerca.
        • Primo post
          Ultimo post
        Home Accedi Registrati
        Menu
        • CATEGORIES
        • La Community Connect.gt
        • Presentati alla Community
        • News Ufficiali da Connect.gt
        • Internet News
        • A Scuola Di
        • Digital Marketing
        • Intelligenza Artificiale
        • SEO & GEO
        • Web Marketing e Content
        • Google Analytics e Web Analytics
        • Google Ads & Advertising
        • YouTube
        • TikTok, Instagram e altri Social
        • Google Adsense, Affiliazioni e Guadagno
        • E-Commerce
        • Coding e Sistemistica
        • Help Center: consigli per il tuo progetto
        • Hosting e Cloud
        • Coding
        • CMS & Piattaforme Self-Hosted
        • Annunci e Collaborazioni
        • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
        • Collaborazioni WEB e Lavoro: offro e cerco
        • Impresa, Fisco e Leggi
        • Consulenza Legale e Professioni Web
        • Consulenza Fiscale, Imprese, Startup e P.Iva
        • Gli Off Topic
        • PC, Smartphone e altri Hardware
        • Tutti i Software
        • GT Fetish Cafè
        • Discussioni
        • Non letti 0
        • Recenti
        • Hashtag
        • Popolare
        • Utenti
        • Privacy
        • Termini e condizioni
        • © 2026 Search On Media Group S.r.l.