Plugin Directory

Changeset 2834942


Ignore:
Timestamp:
12/16/2022 09:11:44 AM (3 years ago)
Author:
recruitly
Message:

Add industry to taxonomies

Location:
recruitly/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • recruitly/trunk/admin/dataloader.php

    r2831812 r2834942  
    9898    ));
    9999
     100    $industry_id = recruitly_get_taxonomy_id($job->industry, 'jobindustry');
    100101    $sector_id = recruitly_get_taxonomy_id($job->sector, 'jobsector');
    101102    $job_type_id = recruitly_get_taxonomy_id($job->jobType, 'jobtype');
     
    257258    }
    258259
     260    if (!empty($industry_id)) {
     261        wp_set_post_terms($post_id, array($industry_id), 'jobindustry', false);
     262    }
     263
    259264    if (!empty($county_id)) {
    260265        wp_set_post_terms($post_id, array($county_id), 'jobcounty', false);
     
    302307    ));
    303308
     309    $industry_id = recruitly_get_taxonomy_id($job->industry, 'jobindustry');
    304310    $sector_id = recruitly_get_taxonomy_id($job->sector, 'jobsector');
    305311    $job_type_id = recruitly_get_taxonomy_id($job->jobType, 'jobtype');
     
    475481    }
    476482
     483    if (!empty($industry_id)) {
     484        wp_set_post_terms($post_id, array($industry_id), 'jobindustry', false);
     485    }
     486
    477487    if (!empty($sector_id)) {
    478488        wp_set_post_terms($post_id, array($sector_id), 'jobsector', false);
  • recruitly/trunk/admin/includes/taxonomies.php

    r2825268 r2834942  
    88function recruitly_wordpress_setup_taxonomies()
    99{
     10
     11    try {
     12
     13        if (!taxonomy_exists('jobindustry')) {
     14
     15            $labels = array(
     16                'name' => 'Job Industries',
     17                'singular_name' => 'Job Industry',
     18                'search_items' => 'Search Job Industries',
     19                'all_items' => 'All Job Industries',
     20                'edit_item' => 'Edit Job Industry',
     21                'update_item' => 'Update Job Industry',
     22                'add_new_item' => 'Add New Job Industry',
     23                'new_item_name' => 'New Job Industry',
     24                'menu_name' => 'Job Industries'
     25            );
     26
     27            register_taxonomy('jobindustry', RECRUITLY_POST_TYPE, array(
     28                'hierarchical' => true,
     29                'labels' => $labels,
     30                'query_var' => true,
     31                'show_admin_column' => false
     32            ));
     33
     34        }
     35
     36
     37    } catch (Throwable  $ex) {
     38    }
    1039
    1140    try {
     
    262291        recruitly_delete_terms_data('jobcounty');
    263292        recruitly_delete_terms_data('jobcountry');
    264 
    265293        recruitly_delete_terms_data('jobsector');
    266294        recruitly_delete_terms_data('jobtype');
     
    271299        unregister_taxonomy_for_object_type('jobcounty', RECRUITLY_POST_TYPE);
    272300        unregister_taxonomy_for_object_type('jobcountry', RECRUITLY_POST_TYPE);
    273 
    274301        unregister_taxonomy_for_object_type('jobsector', RECRUITLY_POST_TYPE);
    275302        unregister_taxonomy_for_object_type('jobtype', RECRUITLY_POST_TYPE);
     
    282309
    283310    try {
     311        recruitly_delete_terms_data('jobindustry');
     312        unregister_taxonomy_for_object_type('jobindustry', RECRUITLY_POST_TYPE);
     313    } catch (Throwable  $ex) {
     314        //Ignore for backward compatibility
     315    }
     316
     317    try {
    284318        recruitly_delete_terms_data('joblocation');
    285319        unregister_taxonomy_for_object_type('joblocation', RECRUITLY_POST_TYPE);
  • recruitly/trunk/recruitly-wp.php

    r2831810 r2834942  
    44Plugin URI: https://recruitly.io
    55Description: Recruitly job board integration.
    6 Version: 2.0.13
     6Version: 2.0.14
    77Author: Recruitly
    88Author URI: https://recruitly.io
    99License: GNU GENERAL PUBLIC LICENSE
    1010*/
    11 define('RECRUITLY_PLUGIN_VERSION', '2.0.13');
     11define('RECRUITLY_PLUGIN_VERSION', '2.0.14');
    1212
    1313defined('RECRUITLY_POST_TYPE') or define('RECRUITLY_POST_TYPE', 'current-vacancies');
Note: See TracChangeset for help on using the changeset viewer.