Home › Forum › Problemi Vari con WP › Problema con frammenti di codice HTML in articolo
-
AutorePost
-
-
5 Settembre 2017 alle 16:12 #31543nickPartecipante
Ciao,
in siti in HTML uso prism: http://prismjs.com/
per inserire dei frammenti di codice JS, CSS, PHP etc.
Ora ho implementato Prism in un’installazione WP, funziona perfettamente, ma mi sono accorto che WP i commenti HTML proprio non li legge.
Es:
<span id="navi-trigger">
<span class="navi-trigger-text">
<!--<span class="navi-trigger-text-menu navi-trigger-text-inn">MENU</span>
<span class="navi-trigger-text-close navi-trigger-text-inn">CLOSE</span>-->
</span>
<span class="navi-trigger-inn"></span>
</span>
C'è un modo per mostrare integralmente un codice HTML? In particolare se commentato dai tag
(aggiungo volutamente degli spazi) < ! - - commento - - >
Per essere sicuro di questo ho provato a usare un qualsiasi tema di base e senza alcun plugin attivo, stessa cosa.
Grazie. -
7 Settembre 2017 alle 8:17 #121841TittiModeratore
C’è un modo per mostrare integralmente un codice HTML?
Mostrarlo dove?
-
8 Settembre 2017 alle 4:03 #121855nickPartecipante
In un post, un articolo
-
8 Settembre 2017 alle 10:00 #121857TittiModeratore
Non vedo il problema, a me funziona normalmente.
Ovviamente devi essere in “visuale” e aver selezionato “preformattato”. Salvi e il risultato è questo: http://funkyimg.com/i/2x9cj.jpg
-
8 Settembre 2017 alle 14:33 #121858nickPartecipante
Da quello che ho scoperto con alcune ricerche WP non visualizza codice HTML tra i tag CODE o PRE
difatti: https://imgur.com/a/bplDX
In questo articolo c’è la soluzione anche per risolvere il problema con i “<” e “>” che inizialmente sostituivo con “< ;” e “> ;” (entrambi senza spazio prima del punto e virgola)
In pratica ho risolto tutto, posso anche pubblicare un codice PHP, perfettamente visibile, ma non trovo la soluzione per i commenti HTML, che in realtà non sono i commenti che mi interessano ma ad esempio i tag condizionali che iniziano con <!
-
8 Settembre 2017 alle 17:18 #121860TittiModeratore
Non so di che articolo parli.
Non c’è nessun problema di codice: ripeto, devi essere in visuale e aver selezionato preformattato.
-
9 Settembre 2017 alle 6:43 #121866nickPartecipante
Non so di che articolo parli.
Evidentemente ho dimenticato di postare il link se ho parlato di un articolo e non l’ho postato: https://css-tricks.com/posting-code-blocks-wordpress-site/
Non so di che articolo parli.
Non c’è nessun problema di codice
Usare il testo preformattato in modalità Visuale è al momento l’unica possibilità anche se più macchinosa, devo prima crearlo in un post in modalità Visuale e poi copiare e incollare da modalità testo in un post che già contiene altri codici, in pratica WP sostituisce < con < etc.,
inoltre perdo purtroppo il murkup colorato.
Cosଠottengo qualcosa del genere: https://imgur.com/a/jp3Yi
-
11 Settembre 2017 alle 10:19 #121872TittiModeratore
Veramente usare pre è la possibilità *più semplice* e meno macchinosa che c’è, macchinoso magari è il sistema che usi e il copia/incolla, cosa che non capisco ma che probabilmente, se la fai, avrai i tuoi buoni motivi per fare. Data questa personalizzazione non so che altro dirti visto che il problema delle perdite sembra risiedere proprio nei copia-incolla.
Posso solo dirti di cercare un altro plugin che ti vada meglio tra i molti che permettono di inserire codice, o continuare a usare quello che dici già di usare magari chiedendo supporto all’autore, o altri consigliati nella pagina che tu stesso hai fornito o mediante ricerche simili:
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.