blog 
Making a Blook with Wordpress and Pages
For a few months now, I’ve wanted to create a blook (blog + book) from the posts I’ve written in 2006 (something like the Lifehacker book). I’ve been waiting for Blurb to get around to it, but their application can only import wordpress blogs that are hosted on wordpress.com. Since my blog is hosted remotely, that’s a no go. I exchanged a couple emails with somebody at their company who informed me that sometime in 2007 their program would have the ability to import all wordpress blogs, regardless of the hosting situation.
I’m not a patient person.
And so, when I was reminded about my blook desire after reading Ben’s post, I decided to put off the ~10 other things I was supposed to do today (except for attending the temple, of course) and write my own script to do just this.
Here’s what the script does:
- At the top you enter the necessary data to connect to your wordpress database as well as a starting and ending date for running the query.
- The script will then extract all posts and comments between the given date range.
- All links are removed from the posts and comments, leaving just the words that were linked along with a footnote mark. After the post/comment, a list of the links (with their corresponding footnote numbers) is printed.
- All embedded youtube and google videos are removed. The script replaces the video with the text {VIDEO: http://urlOfVideo}.
- CSS classes are assigned to the post title, date text, links and comment titles, and link list. This allows you to change all global styles in Pages (or a similar app), so that if you want to change all your post titles to red, you can change it once and be done.
Once you’ve configured the script as you want it, upload it somewhere and pull it up in your browser. What you should see is the dump of all the posts/comments in the date range you specified.
I then saved the HTML file to my local machine and opened it up in Pages. I’m sure other programs would work fine as well, but I prefer Pages over Word, and don’t know InDesign all that well.
Opening the file might take a while, depending on the number of posts/comments you extracted. Once the file was open I styled the imported CSS styles as I liked them, applying them globally. To do this, go to View -> Show Styles Drawer. As an example, reformat one of the post titles as you want it, then click on the arrow to the right of the style named “title”. From the drop down, select “Redefine Style From Selection”. This should change all the post titles in the document. Rinse and repeat for other styles as desired.
Pages didn’t import floated elements correctly, so I had to manually format my images so that they floated the text around them.
Once it’s formatted as you want it, simply export it as a PDF and use a service such as Lulu to print!
Download: blook.zip – unzip, remove .txt extension, and upload to your server after configuring.
Enjoy! If you come across any bugs please let me know. Also feel free to modify the script to your heart’s content. It’s license-free. Yum!
UPDATE: This script is now UTF8-compliant and will work for all Wordpress blogs, including those that require UTF8. Thanks to Ken.
***************
26 comments so far. Care to chime in?
Hmmm.. Apparently lulu.com has an upper limit of 740 pages for its books. My posts from 2006 (with comments) ended up being 1328 pages long. Drat.
#2 Michael L. Mc Kee | January 27th, 2007 9:13 PMConnor
Your post leaves me absolutely in the dark as I have no idea what you are talking about, and am therefore speechless.
Michael,
You’ll have to forgive the indulgence of my nerdy side, something I don’t show too often on this blog, as I tend to stick to political/religious topics. I promise it’ll be a long time before I post something technical again. :)
#4 mmathson | January 27th, 2007 11:06 PMDon’t worry, some of us out here like reading the nerdy stuff :)
#5 Novelr.com - Making People Read - » Blook Plugin | January 28th, 2007 12:58 AM[...] Boyack has released a pretty good interesting plugin yesterday in his blog. It basically pulls all the posts you have on a stand-alone wordpress install [...]
#6 Carolynn Duncan | January 29th, 2007 3:08 PMConnor,
This is awesome. I’m trying it out. If you don’t mind, I’ll probably send you a tech support question or two. ;) I’m a newbie.
#7 Nathan | November 22nd, 2007 4:17 PMI just tried to download the script but I’m getting a mysql_connect() error.
Could you fix this so I can get your script?
Thanks!
–
Nathan
Nathan, the link has been updated to point to a zip file instead. Save that to your computer and that should be usable.
#9 Blooking : Simplicitas | Ken Liu | January 28th, 2008 7:41 PM[...] personally recommend Connor Boyack’s blooking script, which extracts posts from a specified date range and wraps the relevant blocks in CSS styles that [...]
M&M,
As the post notes, this is only for Wordpress. :) Hosted blogs (on blogspot.com and wordpress.com) prevent access to the full database, and usually only allow you to export the data in a proprietary format that would have to be parsed through… A project for someone else, perhaps. :)
#12 m&m | January 29th, 2008 10:47 PMsorry…missed that. Obviously, I’m not a techie. I finally get it, though.
#13 chelle | February 21st, 2008 1:39 PMI clinked the link and was sent to a garbled page … is this script still available? I am very interested in trying it out :) Thanks
#15 chelle | February 21st, 2008 1:56 PMlol ok, I think I must be doing something wrong … I click and it WORKS! w00t and then I am …. what the … hehe Thanks for updating the link. I look forward to playing around with the script! Seriously thought I was going crazy loco!
#16 Beth | February 22nd, 2008 2:47 PMI see my husband left a comment above — that was a long time ago now. :-)
Just wanted to thank you for the script you wrote! I saw a blook service on a friend’s page but it used Blogger — so I asked around to my technologically-gifted friends and my brother Alex quickly got back to me with this post. My husband (Nathan) then used your script to print out my blog. It was the best birthday present ever — I am so excited! Thanks so much for sharing this!
Already a few of my blogger-friends with Wordpress have asked about it — I am referring them over here. Thanks!
#17 John | March 3rd, 2008 6:04 PMThanks for the script… worked like a charm on my wife’s blog. Just submitted a 490 page blook of our family to Lulu.
Lulu wouldn’t accept the PDF exported by Pages (lulu evidently doesn’t support the Mac 10.4.11 PDF encoding from Pages 08). I re-uploaded as a .doc, and worked fine. Odd.
I’ve been trying to accomplish this seemingly simple task for about 3 months. Thanks a million!
John
#18 Daisy Chain » Birthday Present | April 30th, 2008 6:16 PM[...] to add the link to Connor Boyack’s post regarding the script — this is actually what we used, though keep in mind that Nathan tweaked the code a bit to [...]
#19 O’DonnellWeb - This is not a homeschooling blog » Blog Archive » links for 2008-06-17 | June 17th, 2008 4:30 PM[...] Connor’s Conundrums » Making a Blook with Wordpress and Pages (tags: blogging books wordpress) [...]
#20 Karl | July 11th, 2008 11:33 PMThanks so much for posting this!!!!! You saved me a TON of work. You’re great. The only glitch I ran into was that lulu wouldn’t accept a Pages document nor would it accept a PDF that was created from Pages. So, I had to export my Pages document as a Word document and then it worked fine.
#21 Jeff T. | October 17th, 2008 9:35 AMSo, is there an easy way to do this for wordpress.com blogs? Or should I just covert to wordpress.org… since I know I will eventually someday anyways…
#22 jenn | February 5th, 2009 3:49 PMAny chance you’ll write up a more step-by-step tutorial on how to use this little gem for those of us who aren’t terribly techie? I’ve got a basic knowledge of CSS, and I *think* I’ve entered the correct info in the script for my personal preferences. But, when you say “upload it somewhere and pull it up in your browser” I get lost (on what should probably be the easiest part!). Can you give me a little more direction on where a good place to upload it is?
#23 coolreddy | February 12th, 2009 10:41 PMAwesome! This is a great script. I use my wordpress install as my personal daily diary, and wanted a way to get a report of what I did during a particular week. This works great! Thanks a lot for sharing this. The only problem I see with the script is that it collects all the different revisions of the post. For now I disabled the revision control, but it still dumps 2 versions of the same post. Any ideas? Thanks!
#24 Tobeob | March 7th, 2009 6:26 AMFantastic idea! Unfortunatly I am getting the same problem as coolreddy :-(
#25 Tobeon | March 7th, 2009 6:51 AMAh ha, simple solution. Edit the php file and on line 35 add “and post_status=’publish’”
e.g.
$query = “select wp_posts.ID, post_date, post_title, post_author, post_content, display_name from wp_posts left join wp_users on wp_posts.post_author=wp_users.ID where post_date >= ‘$date_start’ and post_date <= ‘$date_end’ and post_status=’publish’”;
(I add “and post_type=’post’” aswell because I don’t want my pages in there!)
#26 coolreddy | May 3rd, 2009 11:13 PMThank you so much Tobeon.. You rock! This works. Now the next question: I have two categories personal and business. I want to add another “and” to the query so that I can fetch only a specified category.
I tried adding “and post_category=0, but that doesn’t help. Looks like the category name is stored in wp_terms.I tried adding wp_terms.name=’Personal’, but that doesn’t work as well. I am sure it’s an easy one for a MySQL wiz.. Anyone one have any thoughts?
Post a comment
what's new
Featuring 747 posts w/ 11,406 comments.
Search the blog
Media/Events
- 12/21/09 Op-ed, Daily Herald
- 12/2/09 Op-ed, Deseret News
- 11/18/09 Lecture, Young Americans for Liberty UVU Chapter
- 11/5/09 Op-ed, Salt Lake Tribune
- 9/16/09 Op-ed, Daily Herald
- 9/4/09 Talk radio guest appearance
Recent Comments 
- Kelly W. on Breaking the Law to Enforce the Law
- tasmanian angel on Why America Should Apologize
- Kelly W. on Why America Should Apologize
- Jon on Why America Should Apologize
- Carl Youngblood on Why America Should Apologize
- Doug Bayless on Why America Should Apologize
- Jon on Why America Should Apologize
- Harley Pebley on Enforcing the Law on Law Enforcement
- Ool on General Welfare
- Isaac on Prophetic Quotes on America's "Destiny"
- Isaac on The Arrogance of America's Aristocracy
- jim on Enforcing the Law on Law Enforcement
- Jim Davis on Enforcing the Law on Law Enforcement
- Kelly W. on Enforcing the Law on Law Enforcement
- Kelly W. on Enforcing the Law on Law Enforcement
- View extended list »
Most Commented
- Why Do Latter-day Saints Ignore Ron Paul? (329)
- Why I’m For Ron Paul and Against Mitt Romney (263)
- Religion and Politics: The LDS Church and Proposition 8 (165)
- Outrage Over a Shoe (153)
- The Protected Class of Sexuality (152)
- Breaking: New Anti-Proposition 8 Campaign to Target LDS Church President Thomas S. Monson (152)
- Council on Foreign Relations (125)
- Glenn Beck’s Broad Brush (125)
- FLDS Petition Conclusion (121)
- Brigham Young on Public Education (118)
- Domestic Enemies of the Constitution (116)
- Harry Reid Against the “Right Wingers” (115)
- Health Care Hocus Pocus (115)
- Media Blacklisting Ron Paul (110)
- On President Hinckley’s “War and Peace” (106)
- Monarchial Remnants (103)
- The Rights of an Embryo (103)
- Some Questions on 9/11 (96)
- A New Year for Patriotism (89)
- Constitutional Questions (85)
- View extended list »
Recent Posts
- Enforcing the Law on Law Enforcement
- The Unwarranted Expansion of Administrative Subpoenas in Utah
- Why America Should Apologize
- On the Necessity of Repentance
- The Arrogance of America's Aristocracy
- Constitution, Conscience, Constituency
- On Amendments and Constitutional Purity
- The Misplaced Ire of Citizens United
- Why the Latter-day Saints Prepare
- The Failure of Foreign Aid
- Life, Liberty, and the Pursuit of Happiness... Unless You're in Utero
- Utah Senator Bob Bennett is No Friend of the Constitution
- On Whether to Tear Down or Build Up
- The Redemption of the Republicans
- The Criminalization of the Citizenry
- Punishing the Many to Protect the Few
- A New Year for Patriotism
- GOED: Redistributing Utah's Wealth
- The Hyper-Sexual Indoctrination of Children
- Stay the Course... of the Titanic
- View extended list »
Church Talks
- On the Necessity of Repentance
- Why the Latter-day Saints Prepare
- The Family: A Proclamation to the World
- For the Strength of Youth—Service to Others
- For the Strength of Youth—Honesty
- For the Strength of Youth—Music and Dance
- For the Strength of Youth—Entertainment and Media
- For the Strength of Youth—Family
- Inviting the Savior Into Our Home Through Worship
- Gratitude
Aaaaarchives
- March 2010 (2)
- February 2010 (6)
- January 2010 (7)
- December 2009 (8)
- November 2009 (8)
- October 2009 (7)
- September 2009 (8)
- August 2009 (6)
- July 2009 (8)
- June 2009 (6)
- May 2009 (8)
- April 2009 (7)
- March 2009 (8)
- February 2009 (8)
- January 2009 (10)
- December 2008 (10)
- November 2008 (12)
- October 2008 (13)
- September 2008 (10)
- August 2008 (8)
- July 2008 (9)
- June 2008 (10)
- May 2008 (7)
- April 2008 (9)
- March 2008 (12)
- February 2008 (10)
- January 2008 (11)
- December 2007 (11)
- November 2007 (14)
- October 2007 (12)
- September 2007 (10)
- August 2007 (20)
- July 2007 (7)
- June 2007 (13)
- May 2007 (21)
- April 2007 (23)
- March 2007 (26)
- February 2007 (23)
- January 2007 (29)
- December 2006 (33)
- November 2006 (55)
- October 2006 (62)
- September 2006 (27)
- August 2006 (32)
- July 2006 (68)
- June 2006 (26)
featured shtuff
PORTFOLIO
Web/print design and development (and other stuff!), done right.
MIKE LEE
Restoring the founding principles of our Constitution.
QUOTY
Save and tag your favorite quotes, and share w/ your friends!
BOOK OF MORMON
Join Elder Holland in declaring your witness to the world!
UTAH PREPPERS
Preparing Deseret, one blogger at a time.
LEADERSHIP EDUCATION
To build men and women of virtue, wisdom, diplomacy, and courage who inspire greatness in others and move the cause of liberty.
POLITICAL RESTORATION
Restore the Republic! Join the Ron Paul Campaign for Liberty.
BOOK LIST
Here's what I'm currently reading.













