Skip to content

Instantly share code, notes, and snippets.

View kish2011's full-sized avatar
🏠
Working from home

Kishore Chandra Sahoo kish2011

🏠
Working from home
View GitHub Profile
@kish2011
kish2011 / count-jobs.php
Created March 6, 2017 11:42
count-jobs.php
/*
* @see WP_Job_Manager_Ajax class line 211 wp_send_json( apply_filters( 'job_manager_get_listings_result', $result, $jobs ) );
*
*/
function custom_job_manager_get_listings_result($result, $jobs) {
$result['post_count'] = $jobs->found_posts;
return $result;
}
add_filter( 'job_manager_get_listings_result', 'custom_job_manager_get_listings_result',10,2 );
@kish2011
kish2011 / count-jobs.js
Last active September 29, 2017 05:18
count-jobs.js
/* add live job count on job search */
jQuery( document ).ready( function ( $ ) {
$('div.job_listings').on('updated_results', (function(_this) {
return function(event, results) {
$('#titlebar .count_jobs').html(results.post_count);
};
})(this));
});
@kish2011
kish2011 / jobster-jobs-function.php
Created February 21, 2017 07:21
Jobster_WP_Job_Manager_Output_Jobs
if (class_exists('WP_Job_Manager_Shortcodes')) {
/**
* Jobster_WP_Job_Manager_Output_Jobs class.
*/
class Jobster_WP_Job_Manager_Output_Jobs extends WP_Job_Manager_Shortcodes {
/**
* __construct function.
* @see add_shortcode( 'jobs', array( $this, 'output_jobs' ) ); in core plugin.
*
@kish2011
kish2011 / function.php
Last active February 20, 2017 12:02
Featured Companies Widget
function featured_company_register_widgets() {
if ( ! class_exists( 'WP_Job_Manager_Widget' ) ) {
return;
}
/**
* Featured Companies Widget
*/
class WP_Job_Manager_Widget_Featured_Company extends WP_Job_Manager_Widget {
@kish2011
kish2011 / function.php
Created February 20, 2017 11:57
Add the Featured Company fields to the admin
/* Add the Featured Company fields to the admin */
add_filter( 'job_manager_job_listing_data_fields', 'admin_add_featured_company_field' );
function admin_add_featured_company_field( $fields ) {
global $post;
$current_user = wp_get_current_user();
if ( $current_user->has_cap( 'manage_job_listings' ) ) {
$fields['_company_featured'] = array(
add_shortcode('job_count_jobs','job_count_jobs');
function job_count_jobs() {
$count_jobs = wp_count_posts( $post_type = 'job_listing' );
$html = '';
if ( $count_jobs ) {
$count_jobs->publish;
$html .= '<h2>';
$html .= $count_jobs->publish;
$html .= esc_attr__( ' "TOTAL JOBS', 'jobster' );
@kish2011
kish2011 / functions.php
Created February 19, 2017 05:14 — forked from danjjohnson/functions.php
WP Job Manager: Append the post id to the permalink slug
function custom_job_post_type_link( $post_id, $post ) {
// don't add the id if it's already part of the slug
$permalink = $post->post_name;
if ( strpos( $permalink, strval( $post_id ) ) ) {
return;
}
// unhook this function to prevent infinite looping
remove_action( 'save_post_job_listing', 'custom_job_post_type_link', 10, 2 );
@kish2011
kish2011 / delete-expired-jobs.php
Last active February 10, 2017 12:35
Delete Expired Jobs
<?php
/**
* @package Delete Expired Jobs
* @version 0.0.1
* @see http://opentuteplus.com/delete-expired-jobs-locomotive/
*/
/*
Plugin Name: Delete Expired Jobs
Plugin URI: https://shop.opentuteplus.com
Description: Delete Expired Jobs
@kish2011
kish2011 / wordpress-plugin-svn-to-git.md
Created January 17, 2017 16:47 — forked from kasparsd/wordpress-plugin-svn-to-git.md
Using Git with Subversion Mirroring for WordPress Plugin Development
@kish2011
kish2011 / wp-job-manager-template-override.php
Last active January 12, 2017 14:02
Filter WPJM template locate to use custom templates
/*
* define( 'JOB_MANAGER_FREELANCING_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
* JOB_MANAGER_FREELANCING_PLUGIN_DIR should be defined in your custom plugin
*
*/
add_filter( 'job_manager_locate_template', 'fl_locate_template', 10, 3 );
/**