New WordPress plugin: Citation Importer ![rw-book-cover](http://stephanieleary.com/wp-content/themes/revolution-pro/images/favicon.ico) ## Metadata - Author: [[Stephanie Leary]] - Full Title: New WordPress plugin: Citation Importer - Category: #articles - Summary: The WordPress Citation Importer plugin imports individual citations, bibliography lists, or lists of DOIs into WordPress via the CrossRef Metadata API. - URL: http://stephanieleary.com/2016/08/new-wordpress-plugin-citation-importer/ The [WordPress Citation Importer plugin](https://wordpress.org/plugins/citation-importer) imports individual citations, bibliography lists, or lists of DOIs into WordPress via the [CrossRef Metadata API](http://search.crossref.org/help/api). Using a publication post type and/or a few custom fields, you could build a local database of publications for your company, university, library, etc. without having to manually enter each field. ##### How it works 1. Enter citations into the editor and select which post type should be the destination. [![WordPress Citation Importer screen 1: text entry](https://readwise.io/reader/imgproxy?url=http%3A//stephanieleary.com/wp-content/uploads/2016/07/screenshot1.png&hash=c35ff7564eb518e386197720ad4986c8)](http://stephanieleary.com/wp-content/uploads/2016/07/screenshot1.png) 2. See if [crossref.org](http://crossref.org)‘s API found the correct publication(s). (The importer returns only the first match for each citation.) If not, you can [run your own search](http://search.crossref.org/references) to find the correct DOIs and enter them into the previous screen. [![WordPress Citation Importer screen 2: confirm search matches to import](https://readwise.io/reader/imgproxy?url=http%3A//stephanieleary.com/wp-content/uploads/2016/07/screenshot2.png&hash=d2a4a538738116340e93e141ab855348)](http://stephanieleary.com/wp-content/uploads/2016/07/screenshot2.png) [![WordPress Citation Importer screen 3: review imported posts](https://readwise.io/reader/imgproxy?url=http%3A//stephanieleary.com/wp-content/uploads/2016/07/screenshot3.png&hash=99dc21dcf1a40c43eaeb502fcd48987e)](http://stephanieleary.com/wp-content/uploads/2016/07/screenshot3.png) 3. Edit the imported data as needed. It will not be refreshed from [crossref.org](http://crossref.org) again after the initial import, so your corrections here will stick. [![Editing the imported publication](https://readwise.io/reader/imgproxy?url=http%3A//stephanieleary.com/wp-content/uploads/2016/07/screenshot4.png&hash=6aca53e315b67efbe878a670d20b1352)](http://stephanieleary.com/wp-content/uploads/2016/07/screenshot4.png) ##### Filters Your WordPress custom fields and taxonomies likely do not match those used by this importer. Therefore, the post fields, custom fields, and taxonomies are all filterable. ###### Post fields Standard post fields (post\_title, post\_content, post\_status, etc.) are stored in the $post array. The original data received from crossref.org is passed to you in the $item object. `apply_filters( 'citation_importer_postdata', $post, $item );` ###### Custom fields Custom fields are given in the $fields associative array, with the meta\_key used as the array key and the meta\_value as the value. The $post array contains the standard post fields, and the $item object contains the crossref.org data. `apply_filters( 'citation_importer_fielddata', $fields, $post, $item );` ###### Taxonomies Custom taxonomies are set in the $terms associative array, with the taxonomy name used as the array key and the term slug (or array of slugs) as the value. The $post array contains the standard post fields, and the $item object contains the crossref.org data. `apply_filters( 'citation_importer_termdata', $terms, $post, $item );` ##### Example Filter Function Here’s an example of a function that splits the source publication’s volume and issue into separate fields (instead of appending them to the title) and adds a field for the page numbers. https://gist.github.com/sillybean/5ff713797644043a9546c850011ecc77 Running the importer with the above plugin activated (and the new fields defined in [ACF](http://advancedcustomfields.com/)), the publication pictured above now looks like this: [![Screenshot of a WordPress editing screen showing the new, separate fields for the publication's volume, issue, and page numbers](https://readwise.io/reader/imgproxy?url=http%3A//stephanieleary.com/wp-content/uploads/2016/07/citation-importer-filtered-fields.png&hash=5597fc3a0cfce043f1ea57a65e4f2b20)](http://stephanieleary.com/wp-content/uploads/2016/07/citation-importer-filtered-fields.png) You could use the filters to split the authors into separate fields, access the various parsed dates, or import more data from the search results (like the ISSN or alternative ID). Visit any record on [crossref.org](http://crossref.org) and view its data as JSON to see all the available fields. ##### More about CrossRef The [CrossRef Metadata API](http://search.crossref.org/help/api) is an amazing tool for [matching formatted citations with their parsed equivalents](http://labs.crossref.org/resolving-citations-we-dont-need-no-stinkin-parser/) in a central database. CrossRef’s Metadata API does not yet include abstracts. You may be able to locate them fairly easily with the DOIs in hand; see [this GitHub issue](https://github.com/CrossRef/rest-api-doc/issues/98) for details. When abstracts become available in the API’s response, they will be added to the plugin’s post data. ##### Download, donate, contribute This plugin is available for [download on wordpress.org](https://wordpress.org/plugins/citation-importer), but it’s also a work in progress, and you can [contribute on GitHub](https://github.com/sillybean/citation-importer). Want to fund further development? [Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4AZXZHUGDCY5S)., New WordPress plugin: Citation Importer, Stephanie Leary, 01gnmcxy0amc84fe5c8t6884bm.