Home › Forum › Problemi Vari con WP › testo fisso fine articolo di un blog
-
AutorePost
-
-
5 Aprile 2017 alle 14:35 #31368mimmoPartecipante
salve
se volessi inserire un testo fisso tipo:
‘Se ti è piaciuto questo articolo puoi seguirmi sulla mia pagina di facebook “https://www.facebook.com/Bumbaca.Domenico/“, aggiungermi su Facebook o tra le cerchie di Google+’
lo devo aggiungere in coda a tutti gli articoli oppure c’è la possibilità di farlo inserire in automatico?
Grazie
-
5 Aprile 2017 alle 16:25 #121519TittiModeratore
Con un plugin oppure se hai un child theme con del codice.
-
5 Aprile 2017 alle 17:52 #121520SteveAglAmministratore del forum
Nel function.php del tuo tema o meglio nel child theme visto che se no perderai la modifica al prossimo aggiornamento del tema) metti:
function wpit_add_something_after_content ( $content ) {
$content = $content . ‘<p>’ .
‘Se ti è piaciuto questo articolo puoi seguirmi sulla mia pagina di facebook LATUAURL, aggiungermi su Facebook o tra le cerchie di Google+’ .
‘</p>’;
return $content;
}
add_filter(‘the_content’, ‘wpit_add_something_after_content’, 10, 1 );
Ovviamente al posto di ‘<p>’ ecc puoi mettere il codice che ti serve. ATTENZIONE PRIMA DI FARE LE MODIFICHE fatti una copia del file function.php se sbagli e non va più nulal ripreistinerai la copia via FTP
-
5 Aprile 2017 alle 19:05 #121521mimmoPartecipante
grazie a tutti
-
6 Aprile 2017 alle 6:20 #121522TittiModeratore
Cosଠperò il testo andrà genericamente sotto ogni contenuto (tipo anche le pagine), quindi se lo vuoi solo sotto ogni articolo sarà
function wpit_add_something_after_content ( $content ) {
if( is_single() )
$content = $content . '<p>' .
'Se ti è piaciuto questo articolo eccetera' .
'</p>';
return $content;
}
add_filter('the_content', 'wpit_add_something_after_content', 10, 1 );E al posto di “è” metti “& egrave;” (scritto tutto attaccato e senza virgolette ovv.)
-
6 Aprile 2017 alle 9:07 #121523SteveAglAmministratore del forum
Ah si giusto non avevo notato che a richiesta era solo per gli articoli
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.