The office_staff post type allows employees to be imported and displayed in the offices.
Create the spreadsheet
This can be done in any spreadsheet software, but LibreOffice Calc is recommended since you'll need to use that to convert it later anyway:
- Create your header row. The columns should be:
- post_type
- post_status
- post_title
- post_author
- post_name
- name_first_meta
- name_middle_meta
- name_last_meta
- title_meta
- email_meta
- phone_office_meta
- phone_mobile_meta
- phone_fax_meta
- address_before_meta
- address_id_meta
- address_after_meta
- office_ids_staff_meta
- office_ids_leadership_meta
- social_facebook_meta
- social_twitter_meta
- bio_meta
- responsibilities_meta
- Populate data:
- post_type = office_staff
- post_status = publish
- post_title = (combine the first and last names into one column for the title (=H2&", "&F2))
- post_author = (1=webteam/admin, 105=Rachel, 828=Jeff)
- post_name = (optional slug)
- name_first_meta = (first name)
- name_middle_meta = (middle name)
- name_last_meta = (last name)
- title_meta = (Job title)
- email_meta = (email address)
- phone_office_meta = (office phone number)
- phone_mobile_meta = (mobile phone number)
- phone_fax_meta = (fax phone number)
- address_before_meta = (Text shown one line above address)
- address_id_meta = (id of the address that represents the staff member's physical office location. See below for key.)
- address_after_meta = (Text shown one line below address)
- office_ids_staff_meta = (Serialized array of office ids. See below for instructions.)
- office_ids_leadership_meta = (Serialized array of office ids. See below for instructions.)
- social_facebook_meta = (link to Facebook account)
- social_twitter_meta = (link to Twitter account)
- bio_meta = (Biography. Must be formatted/encoded. Instructions coming soon.)
- responsibilities_meta = (Serialized array of responsibilities. Instructions coming soon.)
Convert to CSV using LibreOffice
- Open the Excel Spreadsheet in LibreOffice, and choose Save As.
- Select the filetype of csv.
- Confirm you want to save the document as a Text CSF.
- On the options screen:
- Select UTF-8 as charset.
- Field delimiter as ,
- Text delimiter as "
- Check the Quote all text cells box.
- Select OK.
Import Into Wordpress
- Tools > Import > CSV.
- Once the import is complete, clean out the trash.
Serialize Offices/Appointments
Since most staff members will only have one office, you can reuse the same serialized string, and just change the office_id (represented by #### in the examples below).
a:1:{i:0;i:####;}
a:2:{i:0;i:####;i:1;i:####;}
Serialize Responsibilities
First create a JSON object with the list of responsibilities in a text editor. It is multiple lines for readability, we will need to collapse it down to one line for serialization.
{ 1:"Responsibility One", 2:"Responsibility Two", 3:"Responsibility Three" }
Combine/join into one line. The serializer won't be able to parse it if it is on multiple lines. (Ctrl+J) highlighted text in Notepad++
Paste your one-line JSON object into https://www.unserialize.me/ and select "Serialized" for the output.
a:3:{i:1;s:18:"Responsibility One";i:2;s:18:"Responsibility Two";i:3;s:20:"Responsibility Three";}
Paste serialized responsibilities into spreadsheet cell.
Address Key
As of 05/16/2018
3633 | UW-Oshkosh - Office of Internal Audit |
3634 | UW-Green Bay - Office of Internal Audit |
3635 | UW-Platteville - Office of Internal Audit |
3636 | UW-Stout - Office of Internal Audit |
3637 | UW-La Crosse - Office of Internal Audit |
3638 | UW-Stevens Point - Office of Internal Audit |
3639 | UW-Eau Claire - 2154 Old Library |
3640 | UW-Eau Claire - 220 Schofield Hall |
3641 | UW-Eau Claire - 729 Hibbard Hall |
3642 | UW-Eau Claire - 730 Hibbard Hall |
3643 | UW-Milwaukee - Office of Internal Audit |
3644 | UW-Madison - Office of Internal Audit |
3645 | W. Washington |
3646 | Van Hise |
3647 | Regent |
4043 | UW-Whitewater - Internal Audit |
To get an updated list of address IDs, use the following query.
SELECT ID, post_title FROM uwsadb.wp_posts WHERE post_type = 'office_address';