Now reading my favorite books
I’ve been using Rob Miller’s Now Reading plugin to show a list of books I’m currently reading in my blog’s sidebar, as you can see. The plugin allows you to show sublists of books you’re reading, books you’ve read, and books you’re planning to read. However, I wanted more, so I’ve done some hacking. What I’ve added is:
- a new category, ‘Favorite books’;
- an option to display only the category/categories you want;
- a text field for each book to store and later display your own review.
Ideally, the categories would be completely adjustable by the user. However, this proved too much work for one evening, so I’ve only added the one category that I missed the most: favorite books. I wanted those favorite books on a fixed page, without the other books mixed in. So I also changed the nr_get_book() function to allow for an optional parameter. You can pass a string containing the categories you want displayed, separated by a space character. So you could say:
< ?php nr_get_book('unread reading read'); ?>
to get the former three categories. This is also the default if you don’t pass any string at all (so you’re existing call to nr_get_book doesn’t have to change).
If you only want one category, like I wanted only the favorite books, you write:
< ?php nr_get_book('favorites'); ?>
I wanted the favorite books on a separate fixed page. However, WordPress does not allow you to add PHP code to a page (without plugins). So I created a page template, favorite_books.php, which only contains a call to nr_get_book to fetch the favorite books. My favorite books page is based on this template.
Finally I added a review field to each book. This field can be entered in the Manage/Now reading admin page. To display it, add it to the format string in the Options/Now reading admin page.
You can download my hack here. And Rob, if you want, you’re welcome to copy my changes into your official plugin.
2005-11-22. 8 responses.
Beautifully adapted, thanks for this.
I would like to download your hack for Now Reading, but I believe the link is broken. Can you point me in the right direction?
Sorry, Diane, that was a WordPress 2.0 conversion thing. The links should work fine now!
Just wanted to thank you again for the great plugin. I wish that Rob would include them in his new version. Thanks again.
You stated that WordPress doesn’t allow you to edit a page… but you can edit your page template. You can put code in that states < if(is_page(‘Books’)) { //enter your php code here } ?gt;
Danny, I love your implementation of this plugin. You’re one of the few I’ve found who has it working well. Tell me, when I got it running, my images aren’t all uniformed like yours… they’re all oversized. Is there a place in the plugin where you can size the photos?
Hi Danny,
I really like your new modifications… it’s something that I’ve been looking for in a long time. However… I’m not sure how to implement this, can you provide some direction?
Thanks
@Destiny: you’re probably better off with the latest version of Rob’s original plugin. By now, it has been extended with all of the features I added at the time and more. You can find it at http://robm.me.uk/projects/plugins/wordpress/now-reading.