Last active
January 3, 2024 02:43
-
-
Save KaineLabs/14e6808415eea4b556908aefc63c2432 to your computer and use it in GitHub Desktop.
Add Job Listing Support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add the Job Listing Activity support! | |
*/ | |
add_post_type_support( 'job_listing', 'buddypress-activity' ); | |
/** | |
* Track New Job Listing Posts. | |
*/ | |
function yz_job_listing_tracking_args() { | |
// Check if the Activity component is active before using it. | |
if ( ! bp_is_active( 'activity' ) ) { | |
return; | |
} | |
// Set Tracking. | |
bp_activity_set_post_type_tracking_args( 'job_listing', array( | |
'component_id' => buddypress()->blogs->id, | |
'action_id' => 'new_job_listing', | |
'bp_activity_front_filter' => __( 'Jobs', 'youzer' ), | |
'bp_activity_admin_filter' => __( 'created a new project', 'custom-domain' ), | |
'contexts' => array( 'activity', 'member' ), | |
'activity_comment' => true, | |
'bp_activity_new_post' => __( '%1$s created a new <a href="%2$s">project</a>', 'youzer' ), | |
'bp_activity_new_post_ms' => __( '%1$s created a new <a href="%2$s">project</a>, on the site %3$s', 'youzer' ), | |
'position' => 100, | |
'comment_action_id' => 'new_job_listing_comment', | |
'bp_activity_comments_admin_filter' => __( 'Commented a project', 'youzer' ), | |
'bp_activity_comments_front_filter' => __( 'Job Comments', 'youzer' ), | |
'bp_activity_new_comment' => __( '%1$s commented on the <a href="%2$s">project</a>', 'youzer' ), | |
'bp_activity_new_comment_ms' => __( '%1$s commented on the <a href="%2$s">project</a>, on the site %3$s', 'youzer' ), | |
) ); | |
} | |
add_action( 'bp_init', 'yz_job_listing_tracking_args' ); | |
/** | |
* Get Job Listing Post Content. | |
*/ | |
function yz_get_activity_job_listing_body( $content, $activity ) { | |
if ( 'new_job_listing' == $activity->type ) { | |
$post_content = yz_get_wall_new_post( $activity->secondary_item_id ); | |
return $post_content; | |
} | |
return $content; | |
} | |
add_filter( 'bp_get_activity_content_body', 'yz_get_activity_job_listing_body', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment