Visualizzazione 3 filoni di risposte
Visualizzazione 3 filoni di risposte
- Devi essere connesso per rispondere a questo topic.
Email: info@wpitaly.it
Home › Forum › Amministrazione WP › Pagina visualizzabile solo per utenti registrati!
Salve, vorrei trovare un modo per far visualizzare una pagina solo agli utenti registrati! come faccio?
Grazie in anticipo!
negli ultimi giori sul forum ci sono state diverse richieste uguali alla tua, prova a cercare.
A dire il vero ho cercato in giro è ho trovato:
http://codex.wordpress.org/Function_Reference/is_user_logged_in
Però come lo integro al nome della pagine e al contenuto? ( visto che non posso usare il php… ) dovrei fare una modificare al template, ma si porrebbero sempre nuove domande, a me serve solo per una pagina…
Ecco che nuovamente ho trovato la soluzione da solo:
function member_check($atts, $content = null) {
if (is_user_logged_in() && !is_null($content) && !is_feed()) {
return $content;
} else {
return 'Spiacente, questa sezione è disponibile solo per i nostri membri.';
}
}
add_shortcode('member', 'member_check');
Per i posteri che possiedono lo stesso problema: Inserire questo codice in function.php ( del proprio tema ) e per rendere invisibile il testo a gli utenti non registrati usare: [member]testo solo per gli utenti registrati[/member]
Spero di essere stato utile! Nonostante abbiamo cercato nel forum, non ho trovato una soluzione adeguata alla mie esigenze… quindi mi è sembrato opportuno proporre la mia.
WPItaly - Copyright Creative Commons: CC BY-NC-SA 4.0