Job Manager Career Shortcode

Below, you’ll find a detailed guide on how to add the Job Manager Career Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Job Manager Career Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Job Manager Career Plugin and the shortcodes it provides:

Plugin Icon
Job Manager & Career – Manage job board listings, and recruitments

"Job Manager & Career is a comprehensive WordPress plugin that allows you to manage job board listings and recruitments efficiently, making the hiring process simpler and smoother."

★★★★☆ (7) Active Installs: 2000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [THJMF_Utils]

Job Manager Career [THJMF_Utils] Shortcode

The THJMF_Utils shortcode is a job listing utility in the Job Manager Career plugin. It filters jobs based on type, category, location, and featured status. The shortcode initiates a form that allows users to filter job listings. If a filter is applied, the page focuses on the job list, displaying the filtered results. It also includes a pagination feature, allowing users to navigate through multiple pages of job listings. Shortcode: [shortcode_thjmf_job_listing]

Shortcode: [THJMF_Utils]

Parameters

Here is a list of all possible THJMF_Utils shortcode parameters and attributes:

  • type – Specifies the type of job listing
  • category – Defines the job category for the listing
  • location – Sets the location for the job listing
  • featured – Filters the job listings to show only featured jobs
  • count – Determines the number of job listings to display

Examples and Usage

Basic example – Display all job listings without any filters

[thjmf_job_listing /]

Advanced examples

Display job listings of a specific type such as ‘full-time’ or ‘part-time’

[thjmf_job_listing type="full-time" /]

Display job listings from a specific category

[thjmf_job_listing category="engineering" /]

Display job listings from a specific location

[thjmf_job_listing location="New York" /]

Display only featured job listings

[thjmf_job_listing featured="yes" /]

Limit the number of job listings displayed

[thjmf_job_listing count="5" /]

Combine different parameters to create a more specific job listing. For example, display 5 featured engineering jobs in New York

[thjmf_job_listing type="full-time" category="engineering" location="New York" featured="yes" count="5" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [THJMF_Utils] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( THJMF_Utils::$shortcode, array( $plugin_shortcode, 'shortcode_thjmf_job_listing' ) );

Shortcode PHP function:

function shortcode_thjmf_job_listing($atts){
		if( !in_the_loop() ){
			return false;
		}

		if( isset( $_POST['thjmf_find_job'] ) || isset( $_POST['thjmf_filtering'] ) ){
			$this->focus_to_job_list();
			return $this->filter_jobs(true);
		}

		global $wp_query,$post;
		$atts = shortcode_atts( array(
		    'type' => '',
		    'category' => '',
		    'location' => '',
		    'featured' => '',
		    'count'	=> '',
		), $atts );

		$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
		if( isset( $_POST["thjmf_job_paged"] ) ){
			$paged =  absint( $_POST["thjmf_job_paged"] ) + 1;
		}

		ob_start();
		?>
		<div class="<?php thjmf_get_job_listing_class(); ?>">
			<form id="thjmf_job_filter_form" name="thjmf_job_filter_form" method="POST">
				<?php 
				if ( function_exists('wp_nonce_field') ){
					wp_nonce_field( 'thjmf_filter_jobs', 'thjmf_filter_jobs_nonce' ); 
				}
				thjmf_get_template('job-filters.php', $this->get_filter_args()); 
				?>
			</form>
			<?php
			echo '<form name="thjmf_load_more_post" method="POST">';
			echo '<input type="hidden" name="thjmf_job_paged" value="'.esc_attr($paged).'">';
			if ( function_exists('wp_nonce_field') ){
				wp_nonce_field( 'thjmf_load_more_jobs', 'thjmf_load_more_jobs_nonce' ); 
			}
			thjmf_get_template( 'thjm-job-listings-start.php' );
			$jobs = thjmf_get_jobs( $this->get_listing_args(false, $paged) );
			if(!$jobs->have_posts()){
				thjmf_get_template( 'thjm-no-jobs.php' );
			}
			while ( $jobs->have_posts() ) {
				$jobs->the_post();
				thjmf_get_template_part( 'content', 'thjm-listing' );
			}
			
			thjmf_get_template( 'thjm-job-listings-end.php' );
			thjmf_get_template( 'thjm-more-jobs.php', $this->load_more_args( $jobs, $paged ) );
			echo '</form>';
			?>
		</div>
		<?php
		wp_reset_postdata();
		return ob_get_clean();
	}

Code file location:

job-manager-career/job-manager-career/classes/class-thjmf.php

Conclusion

Now that you’ve learned how to embed the Job Manager Career Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *