'Thématique') + array_slice($columns, 2, count($columns) - 2, true);
return array_merge($new_admin_col_arrays);
}
add_filter('manage_conseils_posts_columns', 'add_acf_posts_columns');
add_filter('manage_questions_posts_columns', 'add_acf_posts_columns');
add_filter('manage_brochures_posts_columns', 'add_acf_posts_columns');
/* ----------------------------------------------------------------------
CUSTOMISATION DE LA COLONNE POUR AFFICHER : THEMATIQUE PARENT > THEMATIQUE
------------------------------------------------------------------------*/
function handle_posts_custom_columns($column, $post_id)
{
if ($column != 'thematiques_taxo') {
return;
}
$tax = get_the_terms($post_id, ('thematiques'));
$edit_link = esc_url(get_edit_term_link($tax[0]->term_id, 'thematiques', 'conseils'));
echo '';
if (isset($tax[0]->parent) && $tax[0]->parent != 0) {
$tax_parent = get_term($tax[0]->parent, 'thematiques');
echo $tax_parent->name . " — ";
}
echo $tax[0]->name;
echo '';
}
add_action('manage_conseils_posts_custom_column', 'handle_posts_custom_columns', 10, 2);
add_action('manage_questions_posts_custom_column', 'handle_posts_custom_columns', 10, 2);
add_action('manage_brochures_posts_custom_column', 'handle_posts_custom_columns', 10, 2);
/* ----------------------------------------------------------------------
GESTION DU FILTRAGE
------------------------------------------------------------------------*/
// **** CREATION DES DROPDOWN SELECT DE FILTRAGE
function homegrade_brochures_filter_posts_declare_dropdowns()
{
global $typenow;
global $wp_meta_boxes;
$post_type = (isset($_GET['post_type'])) ? $_GET['post_type'] : 'post';
if ($post_type !== 'brochures' && $post_type !== 'fiches-infos' && $post_type !== 'videos-webinaires' && $post_type !== 'conseils' && $post_type !== 'questions') return;
$thematiques_by_parent = getAllThematiquesTermsByParents();
?>