About this theme: This theme was created for authors to have a place for blogs, and most importantly pages to show off their books. The plugin BD Bookshelf is the repository for all the book information so you enter info once, manage it in one place.

BD Bookshelf Theme

Welcome to your author book showcase theme!

Required Plugin

This theme requires the BD Bookshelf plugin to manage your books and retailer links.

Plugin Not Installed

Please install and activate the BD Bookshelf plugin to manage your books.

Go to Plugins

Plugin Installed

The BD Bookshelf plugin is installed and active.

Quick Links

Settings saved!

'; } $goodreads_id = get_option('bdm_goodreads_author_id', ''); $amazon_id = get_option('bdm_amazon_author_id', ''); bdm_render_intro_message(); ?>

BD Bookshelf Settings

Goodreads Author ID

Your Goodreads author page ID (found in your author URL)

Amazon Author Central ID

Your Amazon Author Central author page ID


Theme Information

Version:

Created by B.D. Murphy

Go to Update Scan

BD Bookshelf - Update Scan

This feature allows you to scan book retailer links to check for updates.

Support the Author

If you enjoy this theme, consider supporting the author!

Venmo PayPal Buy Me a Coffee
'book', 'posts_per_page' => -1, 'post_status' => 'publish')); $updates = array(); foreach ($books as $book) { $formats = array('ebook', 'paperback', 'hardback'); $book_links = array(); foreach ($formats as $format) { $links = BD_BookShelfHelper::get_retailer_links($book->ID, $format); foreach ($links as $link) { $book_links[$link['retailer']][$format] = $link['url']; } } $updates[] = array( 'id' => $book->ID, 'title' => $book->post_title, 'links' => $book_links ); } wp_send_json_success(array('books' => $updates)); } add_action('wp_ajax_bdm_scan_books', 'bdm_check_for_updates'); /** * Theme transition page */ function bdm_theme_transition_page() { $plugin_active = bdm_is_plugin_active(); bdm_render_intro_message(); if (!$plugin_active) { ?>

BD Bookshelf - Theme Transition

BD Bookshelf Plugin Required

Please install and activate the BD Bookshelf plugin before migrating books.

Imported ' . count($imported) . ' books!

'; } } if (isset($_POST['bdm_create_shortlinks_nonce']) && wp_verify_nonce($_POST['bdm_create_shortlinks_nonce'], 'bdm_create_shortlinks')) { $created = bdm_create_shortlinks(); echo '

Created ' . $created . ' short links!

'; delete_transient('bdm_scan_results'); } ?>

BD Bookshelf - Theme Transition

This tool helps migrate books from your existing theme to BD Bookshelf. It scans your site for book-related content and imports them into the BD Bookshelf plugin.

Step 1: Scan for Existing Content

Scan pages and posts for book listings, cover images, and retailer links.

Step 2: Import Books to BookHelper

Title Found Data Status

Step 3: Create Short Links

Generate short links (e.g., /tld, /swtd) for each book.

Transition Notes

array('page', 'post'), 'posts_per_page' => -1)); $found = array(); foreach ($books as $post) { $content = $post->post_content; $has_book_data = false; $book_data = array( 'id' => $post->ID, 'title' => $post->post_title, 'exists' => false, 'cover' => '', 'retailer_links' => array() ); // Check if already a book post if ($post->post_type === 'book') { $book_data['exists'] = true; $has_book_data = true; // Get cover $cover_id = get_post_thumbnail_id($post->ID); if ($cover_id) { $book_data['cover'] = wp_get_attachment_url($cover_id); } // Get existing retailer links $link_keys = array('amazon', 'apple', 'barnes', 'kobo', 'google'); $formats = array('ebook', 'paperback', 'hardback'); foreach ($link_keys as $retailer) { foreach ($formats as $format) { $url = get_post_meta($post->ID, $format . '_url_' . $retailer, true); if ($url) { $book_data['retailer_links'][] = $retailer . ':' . $format; } } } } // Check for book-related content in pages/posts $book_keywords = array('book', 'novel', 'ebook', 'paperback', 'hardback', 'author', 'isbn', 'asin', 'amazon', 'barnes', 'kobo'); $content_lower = strtolower($content); foreach ($book_keywords as $keyword) { if (strpos($content_lower, $keyword) !== false) { $has_book_data = true; break; } } // Check for cover image if (has_post_thumbnail($post->ID)) { $book_data['cover'] = get_post_thumbnail_url($post->ID); $has_book_data = true; } // Check for known retailer URLs $retailer_domains = array( 'amazon.com' => 'amazon', 'barnesandnoble.com' => 'barnes', 'kobo.com' => 'kobo', 'books.apple.com' => 'apple', 'play.google.com' => 'google' ); foreach ($retailer_domains as $domain => $retailer) { if (strpos($content, $domain) !== false) { if (!in_array($retailer, array_column($book_data['retailer_links'], 'retailer'))) { $book_data['retailer_links'][] = $retailer; } $has_book_data = true; } } if ($has_book_data || $post->post_type === 'book') { $found[] = $book_data; } } return $found; } /** * Import found books to BookHelper */ function bdm_import_books_to_bookhelper($book_ids) { $imported = 0; foreach ($book_ids as $book_id) { $post = get_post($book_id); if (!$post) continue; // Check if already a book if ($post->post_type === 'book') { continue; // Already in BookHelper } // Create new book post $new_book = array( 'post_title' => $post->post_title, 'post_content' => $post->post_content, 'post_status' => $post->post_status, 'post_type' => 'book' ); $new_id = wp_insert_post($new_book); if ($new_id) { // Copy cover $cover_id = get_post_thumbnail_id($book_id); if ($cover_id) { set_post_thumbnail($new_id, $cover_id); } // Copy meta fields $meta = get_post_meta($book_id); foreach ($meta as $key => $value) { if (is_array($value) && isset($value[0])) { update_post_meta($new_id, $key, $value[0]); } } $imported++; } } return $imported; } /** * Create short links for books */ function bdm_create_shortlinks() { $books = get_posts(array('post_type' => 'book', 'posts_per_page' => -1)); $created = 0; foreach ($books as $book) { // Check if already has short link $existing = get_post_meta($book->ID, 'short_link_slug', true); if ($existing) continue; // Generate short slug from title $title = sanitize_title($book->post_title); // Take first part and make itshort (max 6 chars) $parts = explode('-', $title); $slug = substr($parts[0], 0, 4); // Add two random chars for uniqueness $slug .= substr(md5($book->ID), 0, 2); update_post_meta($book->ID, 'short_link_slug', $slug); $created++; } return $created; }