NooTheme Premium WordPress Theme › Forums › JobMonster › Add column with job owner name in Applications (Dashboard)
- This topic has 2 replies, 2 voices, and was last updated 4 years, 5 months ago by dbcstrauss.
-
AuthorPosts
-
4 years, 5 months ago #1081787
Hi super team,
today I'm trying to add a column in applications board (Admin Environment).
In this column I would like to have here the name of the company to which the job offer belongs.
I already managed to add the column. But I'm struggling to add the right data, because I found how to retrieve the author's name of the application (get_the_author) but I can't find where and how to get the owner's name of the job offer.
This is what I have so far:
// Dashboard - Applications - Add column
function noo_jobslist_custom_posts_columns( $posts_columns ) {
$posts_columns['job_posted'] = __( 'Departamento', 'noo' );
return $posts_columns;
}
add_filter( 'manage_noo_application_posts_columns', 'noo_jobslist_custom_posts_columns' );
// Dashboard - Applications - Add data to column
function noo_joblist_custom_column_display( $column_name, $post_id ) {
if ( 'job_posted' == $column_name ) {
echo '' . ( get_the_author() ) . '';
}
}
add_action( 'manage_noo_application_posts_custom_column', 'noo_joblist_custom_column_display', 10, 2 );
Can you help me, please?
Thanks in advance,
Cheers,
Daniel C.
4 years, 5 months ago #1081810Hi,
You can try with the following code:
function noo_jobslist_custom_posts_columns( $posts_columns ) {
$posts_columns['job_posted'] = __( 'Departamento', 'noo' );
return $posts_columns;
}
add_filter( 'manage_noo_application_posts_columns', 'noo_jobslist_custom_posts_columns' );
// Dashboard - Applications - Add data to column
function noo_joblist_custom_column_display( $column_name, $post_id ) {
$job_id = get_post_field('post_parent', $post_id);
if (is_wp_error($job_id)) {
return false;
}
$company_id = noo_get_post_meta($job_id,'_company_id');
if ( 'job_posted' == $column_name ) {
if(!empty($company_id)){
echo '' . get_the_title( $company_id ) . '';
}else{
echo '' . ( get_the_author() ) . '';
}
}
}
add_action( 'manage_noo_application_posts_custom_column', 'noo_joblist_custom_column_display', 10, 2 );
Hope it helps!.
Best regards,
tb.
4 years, 5 months ago #1081823Of course it helped. You always do!
Only wish I knew what you know 😀
Cheers,
Daniel C.
-
AuthorPosts
You must be logged in and have valid license to reply to this topic.