Modifying jobs list table columns
Job board templating engine was designed to allow easily modify job board layout, most common request is to change columns that are displayed on the default jobs list. This is possible to do but only in job board templates.
Before going any further please read Introduction to templates article, it explains how to properly modify WPJB templates so you can easily upgrade plugin in future.
Two files are responsible for displaying jobs list:
- /wpjobboard/templates/job-board/index.php – contains jobs list table scheme (columns and headers) and alert subscription form, if you will be adding or deleting column you will want to modify this file
- /wpjobboard/templates/job-board/index-item.php – this file is used “inside” index.php template it contains actual table rows, that is information about selected job.
Inside the index-item.php template file you have access to Wpjb_Model_Job object. This object public properties and methods you can use are described in Wpjb_Model_Job class reference article.
Displaying company logo before job title. In the index-item.php find line <td class=”wpjb-column-title”> and after it add
<?php if($job->getLogoUrl()): ?> <img src=<?php esc_attr_e($job->getLogoUrl()) ?> alt="" /> <?php endif; ?>
Displaying job description excerpt (first 250 characters of description without HTML), open index-item.php and in a place where you want to display excerpt add
<?php esc_html_e(substr(strip_tags($job->job_description), 0, 250)) ?>
Displaying salary Custom Field (assuming you earlier added such custom field)
<?php esc_html_e($job->meta->salary->value()) ?>
Displaying first category title and URL (this will work the same for job types just replace “category” with “type”)
<?php esc_html_e($job->getTag()->category->title) ?> <?php esc_html_e(wpjb_link_to("category", $job->getTag()->category)) ?>
Displaying job description excerpt , i changed
job_description), 250)) ?>
job_description), 0, 350).”…”) ?>
because it was not working for me.
Now it works fine
manage to add the logo in, but it display as actual size
on the demo page, the logo is seen to be able to reduce to smaller size, how can we achieve that?
You can either resize the image using CSS or pass size param to getLogoUrl() function, the code below will do both:
<img src="<?php esc_attr_e($job->getLogoUrl("64x64")) ?>" alt="" style="width:64px" />
On the Job Description page, is it possible to 1) have the Apply Now button go to the companies online application and 2)hyperlink an email address in the job description text box?
1. you can use use Application URL plugin https://wpjobboard.net/kb/application-url/ for this
2. if you are using tinyMCE editor to enter text for job description, then you should be able to use convert email address to link using “Insert/edit link” button.
When adding the code to show the first 250 characters of the job in the jobs list how do I display either a number of dots such as this ‘….’ or ‘find out more’ label with a hyperlink to the job?
Any advice gratefully received.