PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, February 10, 2022

[FIXED] How to get the title of WP Job Manager?

 February 10, 2022     php, wordpress     No comments   

Issue

I want to create a list of a latest job that created in WP Job Manager. But I don't know how to get the job title (class or function) to call in WP Job Manager.

Below is the code for my Hirings Post. But the currently display here is the wordpress post title.

<ul id="hiring-title">
  <span class="line"></span>
  <h4>HIRINGS</h4>

<!-- // Define our WP Query Parameters -->
<?php $the_query = new WP_Query( 'posts_per_page=4' ); ?>
					
<!-- // Start our WP Query -->
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
					
<!-- // Display the Post Title with Hyperlink -->
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
					
<!-- // Repeat the process and reset once it hits the limit -->
<?php 
  endwhile;
   wp_reset_postdata();
?>
</ul>


Solution

Try this:

<ul id="hiring-title">
    <span class="line"></span>
    <h4>HIRINGS</h4>

    <?php
    // Get jobs
    $jobs = get_job_listings();

    // Jobs found, list them
    if ( $jobs->have_posts() ) {

        while ( $jobs->have_posts() ) : $jobs->the_post();
        ?>
        <li><a href="<?php the_job_permalink() ?>"><?php wpjm_the_job_title(); ?></a></li>
        <?php
        endwhile;

    } // No jobs available / found
    else {
        ?>
        <li>No jobs available.</li>
        <?php
    }

    // Restore original post object
    wp_reset_postdata();
    ?>
</ul>

For more details, please check WP Job Manager's documentation.



Answered By - cabrerahector
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing