Issue
I want to create a list of a latest job that created in WP Job Manager. But I don’t know how to get the job title (class or function) to call in WP Job Manager.
Below is the code for my Hirings Post. But the currently display here is the wordpress post title.
<ul id="hiring-title">
<span class="line"></span>
<h4>HIRINGS</h4>
<!-- // Define our WP Query Parameters -->
<?php $the_query = new WP_Query( 'posts_per_page=4' ); ?>
<!-- // Start our WP Query -->
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
<!-- // Display the Post Title with Hyperlink -->
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<!-- // Repeat the process and reset once it hits the limit -->
<?php
endwhile;
wp_reset_postdata();
?>
</ul>
Solution
Try this:
<ul id="hiring-title">
<span class="line"></span>
<h4>HIRINGS</h4>
<?php
// Get jobs
$jobs = get_job_listings();
// Jobs found, list them
if ( $jobs->have_posts() ) {
while ( $jobs->have_posts() ) : $jobs->the_post();
?>
<li><a href="<?php the_job_permalink() ?>"><?php wpjm_the_job_title(); ?></a></li>
<?php
endwhile;
} // No jobs available / found
else {
?>
<li>No jobs available.</li>
<?php
}
// Restore original post object
wp_reset_postdata();
?>
</ul>
For more details, please check WP Job Manager’s documentation.
Answered By – cabrerahector
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0