WordPress.org

Ready to get started?Download WordPress

Forums

Resume Submissions & Job Postings
Filtering/showing jobs by category (6 posts)

  1. T Klein
    Member
    Posted 1 year ago #

    Say I wanted to just show jobs on a page for a certain category and have different pages for the different categories. Is there a shortcode option for this? or would I have to use another plugin such as this:

    http://wordpress.org/extend/plugins/list-category-posts/

    http://wordpress.org/extend/plugins/resume-submissions-job-postings/

  2. T Klein
    Member
    Posted 1 year ago #

    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".

  3. T Klein
    Member
    Posted 1 year ago #

    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>
  4. kandrews
    Member
    Plugin Author

    Posted 1 year ago #

    Nice! Thanks for posting all that.

  5. Skaos
    Member
    Posted 1 year ago #

    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?

  6. kandrews
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.