Job Manager
Displaying all Categories on a WordPress Page (8 posts)

  1. Pratik Bagaria
    Posted 5 years ago #

    Hi there,

    I have made like 55 categories in the Job Manager plugin.
    I want to display all those categories in a WordPress page with links (like in related categories)

    I am not able to find a solution for the same :(

    Is there a way by which I can display all the categories on a single WordPress page or Post.

  2. luminancedesign
    Posted 5 years ago #

    Hi Pratik,

    Try this:

    // list Job Manager Categories
    $categories = get_terms( 'jobman_category', 'hide_empty=0' );
    foreach( $categories as $cat ) {
        echo "<li><a href='" . get_term_link( $cat->slug, 'jobman_category' ) . "' title='View: $cat->name'>$cat->name</a></li>";
  3. lydia86
    Posted 4 years ago #

    I am having a similar problem, I would also like to display all my categories on a single WordPress page. Where should I paste the above php code? Isn't there a sort-code or something like that which I can put directly in the WordPress page?
    Thank you very much for you help.

  4. luminancedesign
    Posted 4 years ago #

    I created a 'Vacancies' page template and inserted the above code into the body area. See output example:


    'All' is my renamed default Job Manager page that the plugin creates when installed.


    I've also created a 'Latest' page template and done a similar thing, only using a mix of jQuery, PHP and CSS to limit the display to 10 jobs being listed:


    // list Job Manager Vacancies
    $posts = jobman_display_jobs_list('all');
    echo $posts[0]->post_content;

    Hope this helps!

    P.S. An update to the Job Manager plugin was released a few days ago.

  5. tdjhawk
    Posted 4 years ago #

    Thanks for this. Where do we put the code? I'm not a techie, but if you tell me where to put the code, I am sure I can do same.


  6. luminancedesign
    Posted 4 years ago #

    I have it in the page templates after the content call:

    <?php the_content(); ?>
    // list Job Manager Vacancies
    $posts = jobman_display_jobs_list('all');
    echo $posts[0]->post_content;

    I'd suggest creating a test.php template for a test page in WP, then tweaking the template php until you're comfortable with the way it works, then drop your final code into the template page where necessary.

  7. 3ring
    Posted 4 years ago #

    Hey @luminancedesign;

    Any idea how to get a page template to only display jobs from a given category?

  8. luminancedesign
    Posted 4 years ago #

    My method is a little unorthodox - there's definitely a more elegant way than I achieved it, but here goes:

    On the Job Manager plugins' 'Display Settings' I added a 'Job List Template' with the following code:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    This adds a class of the job categories in the plugin Admin Settings, to each of the cells that a jobs link is in, I then used jQuery to find non matching classes, then traverses to remove the parent row - acting as a filter to leave the matched category in the table.

    The category reference was pulled from the ID I'd added to the header.php file:

    <body <?php body_class(); ?> id="<?php echo $post->post_name; ?>">

    and also by adding as a class in the jop post page body template by using jQuery to pull the category name from the table and then add it to the body, e.g.

    $('table td.job-category a:contains("NEW JOBS")').parent('body').addClass('new-jobs');
    $('table td.job-category a:contains("OLD JOBS")').parent('body').addClass('old-jobs');

    So then if an pages body ID or class matches a category, the unmatched rows in the table are removed, leaving only the matching ones.

    I also used the CSS to colour code content for branding.

    Essentially my hack code lists all jobs, compares page ID or class for a match then removes non matching ones to leave jobs in category selected displayed.

    Sorry I'm so bad at explaining it - it took me a while to figure out how to get it working myself, so I know this may not be clear immediately!


    or by category:

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Job Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic