Home › Forum › Plugin e temi di WP › installazione WP-PostViews
-
AutorePost
-
-
12 Settembre 2017 alle 20:36 #31552enricoPartecipante
Salve a tutti, nonostante sia già diverso tempo che giro intorno a wp sono ancora un novello programmatore:
ho installato il plugin WP-PostViews per gestire le statistiche del sito, nel seguire la procedura di installazione si chiede di inserire nel codice php delle pagine alcune righe di codice. Non riesco ad accedere al codice php perché se vado su editor e seleziono la index.php non vedo il codice.
Dove sbaglio?
Pensate ci sia un plugin migliore di quello da me scelto?
Vi ringrazio per l’aiuto
enrico
-
15 Settembre 2017 alle 16:06 #121877TittiModeratore
Devi seguire le istruzioni del plugin.
Dato che devi modificare un file del tema in uso, si suppone che tu abbia già creato un child-theme, altrimenti a ogni aggiornamento del tema perderai questa e le altre modifiche eventualmente effettuate.
Inoltre le modifiche non si effettuano dall’editor di WordPress, ma si agisce via FTP, previa copia del file che si intende modificare. Se nel tuo child-theme non hai ancora quel file, lo crei come da istruzioni del Codex per il child-theme.
In alternativa, come scritto al punto 5, puoi usare uno shortcode direttamente nell’editor dell’articolo.
-
17 Settembre 2017 alle 20:11 #121879enricoPartecipante
Grazie Titti, mi hai dato diverse informazioni utili. Innanzi tutto il child-theme che non ho capito perfettamente cosa sia e come funziona ma mi è chiaro che è importante e che dovrò dotarmene; poi il fatto che le modifiche vadano fatte in locale (che software utilizzi tu per editare il codice?) e poi trasferite a mezzo ftp.
Ma quali sono i file nei quali devo aggiungere il codice di WP-PostViews oltre la index?
Grazie ancora
enrico
-
18 Settembre 2017 alle 12:42 #121880TittiModeratore
Notepad++ per editare il codice
*Per il resto devi leggere le semplici istruzioni date dall’autore del plugin al link che ti ho già dato sopra*
“wp-content/themes/<YOUR THEME NAME>/index.php” non significa che devi necessariamente mettere il codice nell’index.php del tuo tema. àˆ semplicemente l’indicazione della directory in cui trovare il file o i file in cui inserire il codice.
index.php è un file di template generico che si attiva in mancanza di richieste specifiche, poi se invece nel tuo tema fa la funzione di home mancando ad esempio un home.php e tu vuoi mostrare quel dato in home, allora sଠma questo dipende dal tema e da ciò che vuoi tu e che solo tu puoi sapere.
Vale a dire che il codice lo devi inserire nel file o nei file corrispondente/i alle pagine in cui tu vuoi che appaia ciò per cui hai installato il plugin (vedi 2.), dopo il loop (3.), nella posizione dove vuoi che si veda il conteggio (4.).
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.