Thread Starter
T Klein
(@tklein87gmailcom)
I’ll post my finding for everyone to see, with the help of kandrews and a bit of google-fu I figured this out. You need to put a function into your functions.php file.
function my_query_post_type($query) {
if ( is_category() && false == $query->query_vars['suppress_filters'] )
$query->set( 'post_type', array( 'post', 'video', 'attachment', 'rsjp_job_postings' ) );
return $query;
}
add_filter('pre_get_posts', 'my_query_post_type');
WordPress doesn’t allow custom post types by default in its posts query. Where you see array( 'post', 'video', 'attachment', 'rsjp_job_postings' ) );
you can add or remove any custom post types that you don’t want to show.
I only wanted mine to show up underneath the categories listing so I could have a different page for each category of jobs. So I have this line: if ( is_category()
you might need to change that a little to get what you want.
I can now use http://www.mywebsite.net/category/catname/
will only show jobs that are marked underneath the category “catname”.
Thread Starter
T Klein
(@tklein87gmailcom)
Going a step further, add this to your display-jobs.php file where you want the category name to display, and you have an easy to filter list of jobs on the display jobs page. I added it on line 31 just after the_date.
<div class="category">Category: <?php
$category = get_the_category();
if($category[0]){
echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>';
}
?></div>
Nice! Thanks for posting all that.
Hey,
First of all, thanks for the update! It is great! Second, thanks for this thinking, TKlein.
I had the same idea. But for me, it’s important to show the job postings of the different categories on the same website. Can’t we use [jobPostings] and add category attribute to it? Like cat=”9″ for example?
At this time, no, I do not have that ability in place for the shortcode.
I think I will probably add this to the next update though.