Nascondere il box del contenuto con Custom Post Type?
24 mag 2011, 12:11:27
Visualizzazioni: 46.1K
Voti: 25
Ho creato un custom post type e voglio nascondere l'area di testo principale (textarea) nella pagina di pubblicazione/modifica.
È possibile?
Grazie!

Klian
648
Commenti
Tutte le risposte alla domanda
5
1
Sì, rimuovi il supporto dell'editor dal tuo tipo di post personalizzato.
Puoi farlo in due modi.
- Durante la registrazione del tuo tipo di post personalizzato:
Esempio:
$args = array(
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'capability_type' => 'post',
'has_archive' => true,
'supports' => array('title','author','thumbnail','excerpt','comments')
);
register_post_type('book',$args);
2. Utilizzando remove_post_type_support se il tipo di post personalizzato non è definito dal tuo codice (cioè se un altro plugin/tema ha definito il tipo di post personalizzato).
Esempio:
add_action('init', 'my_rem_editor_from_post_type');
function my_rem_editor_from_post_type() {
remove_post_type_support( <POST TYPE>, 'editor' );
}

Hameedullah Khan
6.01K
24 mag 2011 12:29:48
0
Quando registri il tuo custom post type, non specificare il supporto per l'editor.
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
// nel parametro supports qui non vedi 'editor'
'supports' => array('title','author','thumbnail','excerpt','comments')
);
register_post_type('book',$args);
Per maggiori informazioni vedi: Riferimento Funzioni/register post type.

Azizur Rahman
1.57K
24 mag 2011 12:26:13
0
Puoi rimuovere il titolo o l'editor nel modulo post dell'amministrazione
function mvandemar_remove_post_type_support() {
remove_post_type_support( 'post', 'title' );
remove_post_type_support( 'post', 'editor' );
}
add_action( 'init', 'mvandemar_remove_post_type_support' );

Tai Nguyen
21
19 nov 2015 12:02:20
0
Puoi anche impostare editor
a false
$supports = array(
'title', // titolo del post
'editor'=> false, // contenuto del post
'author', // autore del post
'thumbnail', // immagini in evidenza
'excerpt', // estratto del post
'custom-fields', // campi personalizzati
'comments', // commenti del post
'revisions', // revisioni del post
'post-formats', // formati del post
);
Spero che questo ti sia utile

Shubham Verma
11
7 feb 2024 06:51:44
Domande correlate
4
risposte
2
risposte