NOTE: Breaking change in 2.0.0: The Public Jobbnorge API is used, and you will have to use and add the employerID. You get the employerID from your Jobbnorge contact. The old block is still available in the 1.0 branch and releases.
Also available at https://wordpress.org/plugins/jobbnorge-block/
This WordPress plugin adds a block to the Gutenberg editor that displays a list of jobs from Jobbnorge.
See: Live Preview | Features | Installation | Use | Filters | Styling | License | Changelog
In 2.0 the new Jobbnorge API is used, and the following features are available ( strikethrough means removed, since it's not in the new API):
- Sort jobs bye deadline, closest first.
- Does not show jobs that are past the deadline.
- Set the number of jobs to display.
Set the number of words in the excerpt.- Set the no jobs message.
- Show or hide the job excerpt.
- Show or hide the job deadline.
- Show or hide the job scope.
Show or hide the job duration.- Display the jobs in a grid or list view.
- Set the number of columns in the grid view.
New features in 2.0:
-
Add more than one employer.
-
If more than one employer is added, order jobs by employer or deadline.
-
Define which employers are available in the block, using the
jobbnorge_employersfilter:add_filter( 'jobbnorge_employers', function( $employers ) { $employers = [ [ 'label' => 'Select employer', 'value' => '', 'disabled' => true, // Optional. ], [ 'label' => 'Employer 1', 'value' => '1234', ], [ 'label' => 'Employer 2', 'value' => '5678', ], ]; return $employers; } );
- Ctrl-click (Windows) or Cmd-click (Mac) to select multiple employers.
- Alt-click (Windows) or Option-click (Mac) to select a range of employers.
Either, add the block from the Block Directory:
-
To add a block from the Block Directory, navigate to the post editor.
-
Place your cursor where you would like a new block option.
-
Select the “Add Block” button in the top-left area of the editor screen.
-
Search for “Jobbnorge” and select the “Jobbnorge" block:
Or, add the block from the WordPress admin:
- In the WordPress admin, go to the "Plugins" screen, click "Add New" and search for "Jobbnorge".
- Click "Install Now" and then "Activate Plugin".
- Use the Gutenberg editor to add the block to a page or post.
You'll find the block in the "widget" category, look for "Jobbnorge".
You get the employerID from your Jobbnorge contact.
Separate multiple employerIDs with a comma, or add employers using the jobbnorge_employers filter.
- In pagination mode (default), set the number of jobs to display per page (10 is default), else set the number of jobs to display.
- Sort jobs bye deadline, closest first.
- Does not show jobs that are past the deadline.
- Set the number of jobs to display.
- Set the no jobs message.
- Show or hide the employer name.
- Show or hide the job excerpt.
- Show or hide the job deadline.
- Show or hide the job scope.
When pagination is enabled an additional option Disable auto scroll on pagination appears. Enabling it prevents the view from scrolling back to the block after changing pages (useful when composing long pages with multiple instances).
If you've added more than one employer, you can order jobbs by employer or deadline.
- Set the number of columns in the grid view.
The jobbnorge_employers filter can be used to define which employers are available in the block:
add_filter( 'jobbnorge_employers', function( $employers ) {
$employers = [
[
'label' => 'Select employer',
'value' => '',
'disabled' => true, // Optional.
],
[
'label' => 'Employer 1',
'value' => '1234',
],
[
'label' => 'Employer 2',
'value' => '5678',
],
];
return $employers;
} );The jobbnorge_cache_path filter can be used to define the cache path. Default is WP_CONTENT_DIR . '/cache/jobbnorge'.
add_filter( 'jobbnorge_cache_path', function( $path ) {
$path = WP_CONTENT_DIR . '/cache/jobbnorge';
return $path;
} );The jobbnorge_cache_time filter can be used to define the cache time. Default is 30 * MINUTE_IN_SECONDS.
add_filter( 'jobbnorge_cache_time', function( $time ) {
$time = 30 * MINUTE_IN_SECONDS;
return $time;
} );Controls when automatic scroll engages after clicking a pagination control. The value is a float representing the fraction of the viewport height (from the top) within which the block must already appear to suppress scrolling (default 0.25). Lower values make scrolling more likely; higher values make it less likely.
add_filter( 'jobbnorge_autoscroll_threshold', function( $threshold ) {
return 0.15; // Scroll only if block starts below top 15% of viewport.
} );If you need to disable scroll entirely for a specific instance you can enable the block setting Disable auto scroll on pagination (adds disableAutoScroll attribute / data-no-autoscroll in markup).
The block html look like this, and uses the following classes for styling:
<ul class="has-employer has-dates has-scope has-excerpts wp-block-dss-jobbnorge">
<li class="wp-block-dss-jobbnorge__item">
<div class="wp-block-dss-jobbnorge__item-title"><a
href="https://www.jobbnorge.no/ledige-stillinger/stilling/XXXXXX">Title</a></div>
<div class="wp-block-dss-jobbnorge__item-meta">
<div class="wp-block-dss-jobbnorge__item-employer">Employer</div>
<time datetime="2023-11-26T00:00:00+00:00" class="wp-block-dss-jobbnorge__item-deadline">Deadline:
1/1/1970</time>
<div class="wp-block-dss-jobbnorge__item-scope">Scope: Full time</div>
</div>
<div class="wp-block-dss-jobbnorge__item-excerpt">The excerpt … <a
href="https://www.jobbnorge.no/ledige-stillinger/stilling/XXXXXX">Read more</a>
</div>
</li>
.
.
.
</ul>is-grid, columns-N (N = 2-6), has-employer, has-excerpts, has-deadline and has-scope are added to the <ul> element depending on the block settings.
Default styling is provided by the style.scss file.
The Jobbnorge Block is copyright 2023 Per Søderlind
The Jobbnorge Block is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
The Jobbnorge Block is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Extension. If not, see http://www.gnu.org/licenses/.



