recommandations

// Recommandations

$labels = array(
    'add_new_item' => __('Ajouter une nouvelle recommandation'),
    'new_item' => __('Nouvelle recommandation'),
    'edit_item' => __('Modifier une recommandation'),
    'view_item' => __('Voir une recommandation'),
    'all_items' => __('Liste des recommandations'),
    'search_items' => __('Rechercher une recommandation')
);

[register_post_type](http://codex.wordpress.org/Function_Reference/register_post_type)('recommandations', array(
    'label' => 'Recommandations',
    'menu_position' => 10,
    'labels' => $labels,
    'description' => __('Les recommandations du Conseil du statut de la femme'),
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'supports' => false,
    'menu_icon' => 'dashicons-clipboard'
));

function recommandation_columns($columns)
{
    $columns['page'] = __('No. Page(s)');
    $columns['description'] = __('Description');
    $columns['sujets'] = __('Sujets');
    $columns['pub'] = __('Publication liƩe');
    unset($columns['date'],
        $columns['title']
    );
    
    return $columns;
}

[add_filter](http://codex.wordpress.org/Function_Reference/add_filter)('manage_recommandations_posts_columns', 'recommandation_columns');


function recommandation_column_content($column_name, $post_id)
{
    
    switch ($column_name) {
        case 'page':
            echo [get_post_meta](http://codex.wordpress.org/Function_Reference/get_post_meta)($post_id, 'page', true);
            break;
        case 'description':
            echo '<a href="' . get_edit_post_link($post_id) . '">' . [get_post_meta](http://codex.wordpress.org/Function_Reference/get_post_meta)($post_id, 'description', true) . '</a>';;
            break;
        case 'pub':
            echo '<a href="' . get_edit_post_link([get_post_meta](http://codex.wordpress.org/Function_Reference/get_post_meta)($post_id, 'noPub', true)) . '">' . [get_the_title](http://codex.wordpress.org/Function_Reference/get_the_title)([get_post_meta](http://codex.wordpress.org/Function_Reference/get_post_meta)($post_id, 'noPub', true)) . '</a>';
            break;
        case 'sujets':
            $terms = [get_the_terms](http://codex.wordpress.org/Function_Reference/get_the_terms)($post_id, 'sujets');
            foreach ($terms as $term) {
                echo '<a href="' . [get_term_link](http://codex.wordpress.org/Function_Reference/get_term_link)($term->slug, 'sujets') . '">' . $term->name . '</a>';
                echo ',';
            }
            break;
    }
    
}

[add_action](http://codex.wordpress.org/Function_Reference/add_action)('manage_recommandations_posts_custom_column', 'recommandation_column_content', 10, 2);

function search_Recommandations_Description($query){
    if (is_admin() & $query->[is_main_query](http://codex.wordpress.org/Function_Reference/is_main_query)()){
        if($query->is_search){
            $args = array( 
          'post_type'=>'recommandations',
          'meta_key' =>'description'); 
      $query->set($args);
     /* *  or is it 
            $query->set_query_var('description)';*/
           
    }
    }
}
[add_action](http://codex.wordpress.org/Function_Reference/add_action) ('[pre_get_posts](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts)','search_Recommandations_Description' );