Visualizzazione 3 filoni di risposte
Visualizzazione 3 filoni di risposte
- Devi essere connesso per rispondere a questo topic.
Email: info@wpitaly.it
Home › Forum › Problemi Vari con WP › query dentro un post su dati esterni
Ciao a tutti,
ho fatto una breve ricerca ma non ho trovato nulla in merito… qualcuno mi sa dire se è possibile fare delle query da dentro un post per caricare dei dati che si trovano in tabelle esterne a quelle di wordpress. Quindi all’interno di un post inserire codice php/sql e connessione a db esterno per recuperare i dati.
Grazie per la risposta…
Lory
Ciao, si e’ possibile, basta che usi dei parametri di connessione per il database che ti serve e scrivi il tuo codice.
WP di suo usa $wpdb che’ e’ l’oggetto per la connessione e variabili varie.
Ho usato questo in una pagina a se, non ho provato dentro ad un ciclo o pagina di wp e quindi dovresti giusto provare a vedere se la connessione non switcha al db esterno in modo permanente(e quindi ti devi riconnettere a Wp una volta che hai finito) o se con l’oggetto $wpdb hai comunque anche la prima.
Ciao m4rko80, grazie per la risposta… riesci a farmi un minimo di esempio? i parametri vanno messi dentro qualche tag?
Grazie,
Lory
WPItaly - Copyright Creative Commons: CC BY-NC-SA 4.0