WordPress.org

Support

Support » Plugins and Hacks » Job Manager » [Plugin: Job Manager] Displaying all Categories on a WordPress Page

[Plugin: Job Manager] Displaying all Categories on a WordPress Page

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi Pratik,

    Try this:

    <ul>
    <?php
    // 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>";
    }
    ?>
    </ul>

    Hello,
    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.

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

    http://www.bberecruitment.co.uk/vacancies/all/

    ‘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:

    http://www.bberecruitment.co.uk/vacancies/latest/


    <?php
    // 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.

    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.

    Thanks

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

    <?php the_content(); ?>
    <?php
    // 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.

    Hey @luminancedesign;

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

    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!

    See:
    http://www.bberecruitment.co.uk/vacancies/all

    or by category:
    http://www.bberecruitment.co.uk/vacancies/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Job Manager] Displaying all Categories on a WordPress Page’ is closed to new replies.
Skip to toolbar