WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Job Manager] Widget - latest jobs (7 posts)

  1. Webtaurus
    Member
    Posted 4 years ago #

    Is there anyway to create a lastest jobs widget?

    In the site I am working on I was using posts as jobs until I found your wonderfull plugin.
    Using the php-code-widget I could list the latest jobs from a category by using this php:

    <ul>
    <?php
    query_posts('cat=3'.'&posts_per_page=5');
    if (have_posts())
    {
       while (have_posts())
       {
            the_post();
            ?>
            <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    
            <?php
       }
    }
    else
    {
            echo '<li>No jobs at the moment</li>';
    }
    ?>
    </ul>

    I am sorry that I do not understand php enough to work out a way to adapt the code in such a way that I could use it with job manager jobs. I suppose there must be more users who would appreciate a way to do this.. Could someone with more php skills give me some clue's ??

    ps. pento I sent you an e-mail about translating to dutch, did you receive it ?

    http://wordpress.org/extend/plugins/job-manager/

  2. Gary Pendergast
    Member
    Posted 4 years ago #

    A job widget is already planned for version 0.6:

    http://code.google.com/p/wordpress-job-manager/issues/detail?id=11

    It seems your email landed in my Spam folder, I'll set you up a translator account there.

  3. Webtaurus
    Member
    Posted 4 years ago #

    Maybe someone else can help me out? Lets leave pento to focus on the next versions... But at least it makes me think that its not as simple as it is with normal posts.

  4. Gary Pendergast
    Member
    Posted 4 years ago #

    Ah, I see. Sorry, I missed that you were after help in getting your code working, too.

    Try changing your query_posts line to:

    query_posts('post_type=jobman_job&posts_per_page=5');

    Let me know how this goes.

  5. Webtaurus
    Member
    Posted 4 years ago #

    Mmm. that works only partly. It displays only 1 job, the one that was added the latest.

    And as to be expected... it also displays the job despite the fact that it has been configured to not show until a future date.
    (you can see it on the url I mailed you, bottom left in sidebar)

    Anymore ideas?

  6. Gary Pendergast
    Member
    Posted 4 years ago #

    Hrrm. This is a bit difficult. The problem is that query_posts() doesn't support a post expiration, so I've had to write one that does it manually.

    For a comparison, look at jobman-display.php line 299, where I use get_posts(), then the loop on line 310 which removes expired jobs. You could use this method, but it is inefficient if you just want to get 5 jobs.

    Sorry I can't be more help than this - query_posts is a bit limiting under some circumstances, this being one of them.

  7. Webtaurus
    Member
    Posted 4 years ago #

    Ah well, my knowledge of php is just too rudimentary. Whatever I try, I just get one job listed. I suppose I will just have to wait for version 0.6...

    Or hope that someone comes with an easy solution.

Topic Closed

This topic has been closed to new replies.

About this Topic