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 / 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 );
/**
@kish2011
kish2011 / gist:193e95473a54e1b39f88ed6f67eb6be5
Created January 12, 2017 06:45 — forked from cubehouse/gist:3839159
WordPress Fake Page Generator - Use in Theme/Plugin to create non-existant pages dynamically
// create fake page called "chat-room"
// modify function and variable names with "ABCD" to whatever you like
// modify variable $fakepage_ABCD_url to the fake URL you require
add_filter('the_posts','fakepage_ABCD_detect',-10);
function fakepage_ABCD_detect($posts){
global $wp;
global $wp_query;
global $fakepage_ABCD_detect; // used to stop double loading

Combine, Minify and Inline CSS In WordPress, in the correct order

Installation

Use copypasta to add to a sub-dir of mu-plugins or use Composer:

  "require": {
 "shelob9/css-inliner" : "*"
@kish2011
kish2011 / hide-edd-coupons.php
Created December 21, 2016 09:40 — forked from bekarice/hide-edd-coupons.php
Hide EDD Coupon fields and codes at checkout
/**
* Snippets to hide EDD coupon fields & codes during the checkout process - handy if you use URLs to apply discounts instead
* Tutorial: http://www.sellwithwp.com/easy-digital-downloads-hide-coupons/
*/
// Removes the field to enter a discount at checkout
remove_action( 'edd_checkout_form_top', 'edd_discount_field', -1 );
// Changes the discount code in the checkout summary to display "Discount applied - " instead of the code
<?php
/**
* Register Team Members metabox as repeatable group fields.
*/
function maintainn_team_members_metabox() {
$prefix = '_maintainn_team_';
$cmb_group = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => __( 'Team Members', 'maintainn-demo' ),