get('book_slug'); } if (empty($book_slug)) { // Try to get from the current page slug $book_slug = get_post_field('post_name', get_the_ID()); } // Try to load book from plugin database $book = null; if (class_exists('BDM_Book_Manager') && !empty($book_slug)) { $book = BDM_Book_Manager::get_book_by_slug($book_slug); } if (!$book) { // Show a message if book not found ?>

title); $description = wp_kses_post($book->description); $cover_url = esc_url($book->cover_image); // Get authors $author_names = []; foreach ($book->authors as $ba) { $author_names[] = esc_html($ba->author_name); } $author_string = !empty($author_names) ? implode(', ', $author_names) : 'B.D. Murphy'; // Get series info $series = null; if ($book->series_id > 0 && class_exists('BDM_Series')) { $series = BDM_Series::get_series($book->series_id); } // Get retail links grouped by format $retail_links = []; if (!empty($book->retail_links)) { foreach ($book->retail_links as $link) { $format = $link->format; if (!isset($retail_links[$format])) { $retail_links[$format] = []; } $retail_links[$format][] = $link; } } // Get rating display $rating_html = ''; if ($book->rating_amazon > 0 || $book->rating_goodreads > 0) { $rating_html .= '
'; if ($book->rating_amazon > 0) { $rating_html .= '' . number_format($book->rating_amazon, 1) . '/5 (Amazon)'; } if ($book->rating_goodreads > 0) { $rating_html .= '' . number_format($book->rating_goodreads, 1) . '/5 (Goodreads)'; } $rating_html .= '
'; } // Social share URL $share_url = home_url('/book/' . urlencode($book->slug) . '/'); ?>
<?php echo $title; ?>
__('eBook', 'bd-bookshelf'), 'paperback' => __('Paperback', 'bd-bookshelf'), 'hardcover' => __('Hardback', 'bd-bookshelf'), 'audio' => __('Audio', 'bd-bookshelf')]; $active_format = 'ebook'; $has_format = []; foreach (array_keys($retail_links) as $f) { $has_format[$f] = true; } $first_format = key($retail_links); $active_format = $first_format; ?> $label) : ?>

name) ); ?>