handling thumbnails for reportages
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6584f7edf2
commit
11ea2f9fde
|
|
@ -264,7 +264,7 @@ function carhop_create_posttype()
|
||||||
'rewrite' => array('slug' => 'reportages'),
|
'rewrite' => array('slug' => 'reportages'),
|
||||||
'menu_icon' => 'dashicons-megaphone',
|
'menu_icon' => 'dashicons-megaphone',
|
||||||
'show_in_rest' => true,
|
'show_in_rest' => true,
|
||||||
'supports' => array('title', 'revisions'),
|
'supports' => array('title', 'revisions', 'thumbnail'),
|
||||||
'menu_position' => 4,
|
'menu_position' => 4,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -334,37 +334,27 @@ add_action('admin_menu', function () {
|
||||||
DESACTIVATE EDITOR FOR ANALYSES & ETUDES --> Analyse only
|
DESACTIVATE EDITOR FOR ANALYSES & ETUDES --> Analyse only
|
||||||
------------------------------------------------------------------------*/
|
------------------------------------------------------------------------*/
|
||||||
|
|
||||||
function carhop_analyses_etudes_maybe_remove_editor()
|
/* ----------------------------------------------------------------------
|
||||||
|
DESACTIVATE EDITOR FOR ANALYSES --> Analyse only
|
||||||
|
------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
function carhop_disable_editor_for_analyses($use_block_editor, $post)
|
||||||
{
|
{
|
||||||
if (get_current_blog_id() !== 1) {
|
if (get_current_blog_id() !== 1) {
|
||||||
return;
|
return $use_block_editor;
|
||||||
}
|
|
||||||
if (!post_type_exists('analyses-etudes')) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_id = 0;
|
if (!$post || $post->post_type !== 'analyses-etudes') {
|
||||||
if (isset($_GET['post'])) {
|
return $use_block_editor;
|
||||||
$post_id = (int) $_GET['post'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($post_id > 0) {
|
$is_analyse = has_term('analyse', 'type-analyse-etude', $post);
|
||||||
$post = get_post($post_id);
|
|
||||||
if (!$post || $post->post_type !== 'analyses-etudes') {
|
if ($is_analyse) {
|
||||||
return;
|
return false;
|
||||||
}
|
|
||||||
$is_analyse = has_term('analyse', 'type-analyse-etude', $post_id);
|
|
||||||
if ($is_analyse) {
|
|
||||||
remove_post_type_support('analyses-etudes', 'editor');
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['post_type']) && $_GET['post_type'] === 'analyses-etudes') {
|
return $use_block_editor;
|
||||||
remove_post_type_support('analyses-etudes', 'editor');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
add_action('load-post.php', 'carhop_analyses_etudes_maybe_remove_editor', 5);
|
|
||||||
add_action('load-post-new.php', 'carhop_analyses_etudes_maybe_remove_editor', 5);
|
|
||||||
|
|
||||||
|
|
||||||
|
add_filter('use_block_editor_for_post', 'carhop_disable_editor_for_analyses', 10, 2);
|
||||||
Loading…
Reference in New Issue
Block a user