Skip to content

Instantly share code, notes, and snippets.

@StuartMorris0
Created July 3, 2019 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StuartMorris0/a1cf1f189d53c87bb6b317ff1f0b116d to your computer and use it in GitHub Desktop.
Save StuartMorris0/a1cf1f189d53c87bb6b317ff1f0b116d to your computer and use it in GitHub Desktop.
Functions PHP - Example for WP Job Manager
<?php
/**
* @author Divi Space
* @copyright 2017
*/
if (!defined('ABSPATH')) die();
function ds_ct_enqueue_parent() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); }
function ds_ct_loadjs() {
wp_enqueue_script( 'ds-theme-script', get_stylesheet_directory_uri() . '/ds-script.js',
array( 'jquery' )
);
}
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>';
}
echo '</ul>';
}
}
add_shortcode('list_categories', 'dm_display_wpjm_categories');
add_theme_support( 'job-manager-templates' );
function my_custom_init() { add_post_type_support( 'job_listing', 'excerpt' ); }
add_action('init', 'my_custom_init');
add_action( 'wp_enqueue_scripts', 'ds_ct_enqueue_parent' );
add_action( 'wp_enqueue_scripts', 'ds_ct_loadjs' );
// Unstick the featured jobs in job listings
add_filter ( 'get_job_listings_query_args', 'unstick_featured_jobs' );
function unstick_featured_jobs( $query_args ) {
$query_args['orderby'] = 'date';
$query_args['order'] = 'DESC';
return $query_args;
}
// Email internals for job submittal
// Admin New Job Notification
add_filter( 'job_manager_email_admin_new_job_to', function( $email ) {
return ['EMAIL1', 'EMAIL2'];
} );
include('login-editor.php');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment