Overview
Classroom Library is a WordPress plugin for managing a classroom book collection. It lets you:
- add and organize books as Publications
- display your library on the front end with a bookshelf shortcode
- search by title, keyword, barcode, or ISBN
- look up book details from Open Library while creating a publication
- track check-outs and check-ins with transaction records
- show book availability on each publication page
This document is for site owners, editors, and developers using the plugin on a live WordPress site.
Requirements
- WordPress 6.5 or newer
- PHP 7.0 or newer
What The Plugin Creates
The plugin adds two custom post types:
Publications: your books and other cataloged itemsTransactions: check-out and check-in records for each publication
Installation
- Upload the plugin folder to
/wp-content/plugins/. - Activate Classroom Library in WordPress.
- Create a page where the library should appear.
- Add the
[bookshelf]shortcode to that page. - Start adding publications from the WordPress admin.
Getting Started
1. Add a publication
Go to Publications in the WordPress admin and create a new item.
Each publication supports:
- title
- main content/description
- featured image
- custom publication details in the sidebar
2. Fill in publication details
Each publication includes these fields:
- Barcode/ISBN: the scannable code or ISBN
- Author first name
- Author last name
- Cover image URL
- OpenLibrary.org key
- Number of copies
- Number available
Recommended setup:
- set Number of copies to the total number you physically own
- set Number available to the number currently available to borrow
- keep both numbers aligned when first creating a new publication
3. Use barcode or ISBN lookup
When creating a new publication in the admin, the plugin adds a lookup form above the editor.
This lookup form is added on the new publication screen. It is not injected into the existing publication edit screen.
Enter or scan a barcode/ISBN and click Find. If Open Library returns a match, the plugin can automatically fill:
- the publication title
- barcode/ISBN
- author name
- cover image URL
- Open Library key
- description/content
This lookup uses Open Library and does not require an API key.
4. Publish the book
Publish the publication once the details are correct. The book can then appear in your bookshelf listing and on its single publication page.
Displaying Your Library
Use the [bookshelf] shortcode on any page or post.
Basic example
[bookshelf]
Shortcode options
cols
Controls how many books appear per row.
Default:
[bookshelf cols="6"]
Example:
[bookshelf cols="4"]
search
Controls whether the search form appears above the bookshelf.
Default:
[bookshelf search="yes"]
Hide the search form:
[bookshelf search="no"]
Combined example
[bookshelf cols="5" search="yes"]
How Search Works
The bookshelf search can help visitors find books in two ways:
- text searches match publication titles and other searchable content
- numeric searches longer than 5 digits are treated like barcode/ISBN lookups
The search form submits with a GET request using the seek parameter, which means search terms appear in the page URL.
If a search returns exactly one publication, the plugin automatically redirects the visitor to that publication’s page.
Single Publication Page
Each publication has its own front-end page. This page can show:
- the cover image
- current availability
- the publication description
- author name
- barcode/ISBN
- a link to Open Library for more information
- check-out and check-in forms
If no custom cover image is available, the plugin displays a fallback book cover image.
Check-Out And Check-In
The single publication page includes borrowing controls for visitors.
Check-out
Users can:
- choose a date
- enter a borrower name
- choose the number of copies to check out when more than one copy is available
If no date is entered, the current date is used. If no number of copies is selected, the transaction defaults to 1 copy.
When a check-out is completed:
- a Transaction is created
- the publication’s available count is reduced
Check-in
Users can:
- choose a date
- enter a borrower name
- choose the number of copies to check in when more than one copy is currently out
If no date is entered, the current date is used. If no number of copies is selected, the transaction defaults to 1 copy.
When a check-in is completed:
- a Transaction is created
- the publication’s available count is increased
Availability logic
The plugin uses the Number available field to determine whether check-out or check-in actions should be shown.
- If
Number availableis0, the check-out form is hidden. - If all copies are available, the check-in form is hidden.
Transactions
Each borrowing event creates a Transaction entry in the admin area.
Transaction records store:
- borrower name
- check-out date
- check-in date
- related publication
- publication barcode
- number of copies involved
These records help you review circulation history for each publication.
Transaction Log On Publication Pages
Logged-in users can view a transaction log on single publication pages.
The log shows:
- borrower name
- checkout date
- checkin date
- copies involved
Visitors who are not logged in do not see this log.
The built-in log also queries transactions by the current publication ID and the publication author, so it is intended to show records associated with that publication’s owner.
Images And Covers
The plugin can display a publication cover from either:
- the publication’s featured image
- the Cover image URL field
If both are available, the featured image is used first.
If neither is available, the plugin shows a built-in fallback image.
Open Library Integration
The plugin uses Open Library in two places:
- admin barcode/ISBN lookup when creating publications
- the “Learn more” link on single publication pages
If Open Library does not return a result, the publication will need to be filled in manually.
Admin Screens
Publications list
The Publications admin table includes custom columns for:
- available copies
- total copies
- barcode
- Open Library link
Transactions list
The Transactions admin table includes custom columns for:
- borrower
- check out date
- check in date
- publication
- copies
Theme And Template Behavior
The plugin uses a custom single template for publication pages.
Template resolution works like this:
- If your theme includes
single-publication.php, WordPress will use that file. - Otherwise, the plugin’s built-in template is used.
This makes it possible to customize the publication page layout without editing the plugin.
Developers
Classroom Library currently provides very limited developer extension points. There are no custom plugin-specific action hooks or filter hooks intended for third-party integrations. The main developer-facing options are the shortcode and the single template override.
Shortcode
The plugin registers this shortcode:
[bookshelf]
Example:
echo do_shortcode( '[bookshelf cols="4" search="yes"]' );
Template override
To override the single publication layout in your theme, add this file:
single-publication.php
Example:
<?php
/* Template override for Classroom Library single publications */
get_header();
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
?>
<main class="my-library-publication">
<h1><?php the_title(); ?></h1>
<div class="entry-content">
<?php the_content(); ?>
</div>
</main>
<?php
}
}
get_footer();
Custom post types
The plugin registers these post types:
mbcl_publicationmbcl_transaction
Example query for publications:
$books = new WP_Query(
array(
'post_type' => 'mbcl_publication',
'posts_per_page' => 12,
'post_status' => 'publish',
)
);
Useful publication meta keys
Common publication meta fields include:
mbcl_publication_barcodembcl_publication_author_first_namembcl_publication_author_last_namembcl_publication_cover_image_urlmbcl_publication_openlibrary_keymbcl_publication_countmbcl_publication_count_available
Example:
$available = (int) get_post_meta( $publication_id, 'mbcl_publication_count_available', true );
Useful transaction meta keys
Common transaction meta fields include:
mbcl_transaction_checkout_datembcl_transaction_usermbcl_transaction_checkin_datembcl_transaction_publication_idmbcl_transaction_publication_barcodembcl_transaction_publication_copies
Example:
$borrower = get_post_meta( $transaction_id, 'mbcl_transaction_user', true );
Troubleshooting
A book does not appear in the bookshelf
Check that:
- the publication is published
- the page contains the
[bookshelf]shortcode - your theme is outputting page content normally
Barcode lookup does not fill book details
Check that:
- the barcode/ISBN is valid
- Open Library has a matching record
- your browser is not blocking the request
Check-out or check-in buttons are missing
Check the publication counts:
- if available copies are
0, check-out is hidden - if all copies are available, check-in is hidden
Search does not return the expected book
Try:
- searching by exact title words
- searching by full barcode or ISBN
- confirming the publication is published
Summary
Classroom Library gives you a simple classroom circulation system inside WordPress. You can catalog books, display them visually, search by title or barcode, and track borrowing activity without relying on a separate library platform.