Skip to content

Instantly share code, notes, and snippets.

View davoraltman's full-sized avatar

Davor Altman davoraltman

View GitHub Profile
@davoraltman
davoraltman / redirectJD
Last active February 28, 2021 03:55
Redirect to Job Dashboard after job submission
add_filter( 'submit_job_steps', 'replace_done_with_redirect' );
function replace_done_with_redirect( $steps ) {
$steps['done'] = array(
'priority' => 30,
'handler' => function() {
if ( wp_redirect( job_manager_get_permalink( 'job_dashboard' ) ) ) {
exit;
}
}
// Add your own function to filter the fields
add_filter( 'submit_job_form_fields', 'custom_submit_job_form_fields' );
// This is your function which takes the fields, modifies them, and returns them
// You can see the fields which can be changed here: https://github.com/mikejolley/WP-Job-Manager/blob/master/includes/forms/class-wp-job-manager-form-submit-job.php
function custom_submit_job_form_fields( $fields ) {
// Here we target one of the job fields (job_title) and change it's label
$fields['job']['job_description']['description'] = "Note: Use headings to make your advert stand out. To see example headings and listing <a href='http://example.com'>click here</a>.";
function dm_display_wpjm_categories () {
$terms = get_terms( array(
'taxonomy' => 'job_listing_category',
'hide_empty' => false,
) );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
echo '<ul>';
foreach ( $terms as $term ) {
echo '<li>' . '<a href="' . esc_url( get_term_link( $term ) ) . '">' . $term->name . '</a></li>';
function listing_expired_send_email( $new_status, $old_status, $post ) {
if ( 'job_listing' !== $post->post_type || 'expired' !== $new_status || $old_status === $new_status ) {
return;
}
$author = get_userdata( $post->post_author );
$message = "
Hi " . $author->display_name . ",
Your listing, " . $post->post_title . " has now expired: " . get_permalink( $post_id );
wp_mail( $author->user_email, "Your job listing has expired", $message );
function get_category_jobs_daki() {
$term = get_term( 31, 'job_listing_category' );
$slug = $term->slug;
$posts = get_posts('job_listing_category=' . $slug . '&post_type=job_listing');
return $count = count($posts);
}
$str .= '<p class="comment-subscription-form"><input type="checkbox" checked name="subscribe_comments" id="subscribe_comments" value="subscribe" style="width: auto; -moz-appearance: checkbox; -webkit-appearance: checkbox;"' . $comments_checked . ' /> ';
@davoraltman
davoraltman / 0_reuse_code.js
Created March 22, 2016 15:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console