我想创建一个在WP作业管理器中创建的最新作业的列表。但是我不知道如何在WP作业管理器中调用工作标题(类或函数(。
以下是我的招聘帖子的代码。但目前显示的是wordpress帖子标题。
<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>
试试这个:
<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>
有关更多详细信息,请查看WP作业管理器的文档。
其他信息:
我的问题是我想将标题分配给一个变量。但是,wpjm_the_job_title
函数直接输出标题。经过长时间的研究,我发现WPJobManager的所有功能都是根据以下模式构建的:
输出标题:
wpjm_the_job_title()
退货标题:
wpjm_get_the_job_title()