Stephanie Leary

Writer and WordPress consultant

  • Books
    • Content Strategy for WordPress (2015)
    • WordPress for Web Developers (2013)
    • Beginning WordPress 3 (2010)
  • Blog
    • Fascism Watch (2016-17)
    • Content Modeling for WordPress series
    • WordPress Hidden Gems series
  • Work
    • Portfolio
    • Services
    • WordPress Plugins
    • WordPress Themes
    • Presentations and Interviews
    • on GitHub →
  • About
    • Press Kit
  • Contact
    • Mailing List

New WordPress plugin: Citation Importer

August 19, 2016 Stephanie Leary 2 Comments

The WordPress Citation Importer plugin imports individual citations, bibliography lists, or lists of DOIs into WordPress via the CrossRef Metadata 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

2. See if 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 to find the correct DOIs and enter them into the previous screen.

WordPress Citation Importer screen 2: confirm search matches to import

WordPress Citation Importer screen 3: review imported posts

3. Edit the imported data as needed. It will not be refreshed from crossref.org again after the initial import, so your corrections here will stick.

Editing the imported publication

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), 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

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 and view its data as JSON to see all the available fields.

More about CrossRef

The CrossRef Metadata API is an amazing tool for matching formatted citations with their parsed equivalents 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 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, but it’s also a work in progress, and you can contribute on GitHub.

Want to fund further development? Donate via PayPal.

WordPress citation importer, crossref, import

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Fascism Watch

The Fascism Watch is a daily(ish) news roundup. View all the previous Fascism Watch posts »

Latest WordPress Book

Content Strategy for WordPress

A short book for content strategists and managers on implementing a complete content strategy in WordPress: evaluation, analysis, content modeling, editing and workflows, and long-term planning and maintenance.

Read the sample chapter

Kindle Nook iBooks Kobo Smashwords

WordPress for Web Developers

WordPress for Web Developers (9781430258667)

This is a book for professional web designers and developers who already know HTML and CSS, and want to learn to build sites with WordPress. The book begins with a detailed tour of the administration screens and settings, then digs into server-side topics like performance and security. The second half of the book is devoted to development: learning to build WordPress themes and plugins.

This is the second, much-revised and updated edition of Beginning WordPress 3, with a more accurate title. Everything’s been updated for WordPress 3.6.

WordPress for Web Developers is out now. See what's inside...

The best WordPress features you’ve never noticed

  • WordPress Hidden Gems: Screen Options
  • WordPress Hidden Gems: Bulk Edit
  • WordPress Hidden Gems: Private Status
  • WordPress Hidden Gems: Dashboard Feed Readers
  • WordPress Hidden Gems: Options.php

Content Modeling for WordPress series

  • Content modeling for WordPress, part 1: analyze content
  • Content modeling for WordPress, part 2: functional and organizational requirements
  • Content modeling for WordPress, part 3: a sample content model

This is an excerpt from Content Strategy for WordPress.My latest books are Content Strategy for WordPress (2015) and WordPress for Web Developers (2013). Sign up to be notified when I have a new book for you.

Copyright © 2021 Stephanie Leary