Home › Forum › Plugin e temi di WP › Plugin per pubblicare testo automatico sotto a ogni post
-
AutorePost
-
-
22 Dicembre 2008 alle 19:40 #8860paulisterPartecipante
Ciao a tutti,
ho trovato qui
una spiegazione di come realizzare un plugin che permetta di inserire del testo automaticamente sotto a un post, ancora prima degli elementi aggiunti da ulteriori plugin, come oknotizie per esempio.
ora: ho creato la pagina .php del plugin inserendo il codice scritto nella pagina linkata, ma non capisco dove devo inserire la riga con il filter e soprattutto, creando la pagina del plugin mi dà un parse errore on line 13. Qualcuno potrebbe scrivermi la pagina del plugin (è già scritta nel link), ma inserendo al punto giusto la riga dove c’è “add filter,….”? Grazie e auguri a tutti
-
22 Dicembre 2008 alle 19:47 #60481SteveAglAmministratore del forum
Perchè chiederlo qua se lo hai già chiesto all’autore e sopratutto questi ti ha pure già risposto?
-
22 Dicembre 2008 alle 22:04 #60487paulisterPartecipante
Ciao, perché ancora ci sono problemi e non funziona, mi dà un errore:
Parse error: syntax error, unexpected T_STRING in /web/htdocs/www.nomesito.it/home/wp-content/plugins/aggiungilink.php on line 10
Il codice del plugin è questo:
<?php
/*
Plugin Name: Aggiungi link
Description: Aggiunge un link alla fine dei post
Author: Daniele Ghidoli
Author URI: http://www.bigthink.it
*/
function aggiungi_link($content = ”) {
  global $post;
  $user = get_the_author_login();
  if($user == ‘paulister’){
    $content .= ‘Per supporto tecnico sugli articoli, problemi con il computer e altro, scrivi sul forum‘;
  }
  return $content;
}
add_filter(‘the_content’, ‘aggiungi_link’, 1);
?>
Ho chiesto anche all’autore e probabilmente risolverò anche con lui, ma chiedo anche qui perché se posso evitare di dargli disturbo per sistemare a me un problema che magari altri non hanno… A presto e auguri a tutti
-
22 Dicembre 2008 alle 22:54 #60488paulisterPartecipante
Ok risolto; il problema lo dava wordpress perché copiando e incollando metteva degli spazi che davano l’errore; levando gli spazi a inizio riga funziona benissimo; a presto
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.