I wrote, designed & sold a book with WordPress and it went pretty well

If you’re writing an ebook, there’s a lot of options on how to publish: SaaS tools, apps, pen & paper, Amazon, etc.

Instead of using other tools, I decided to do as much of the publishing work as I could with WordPress. Here’s what I learned writing, styling, and selling my ebook!

Confession: I love Gutenberg

At the end of last year when I wrote my first page with Gutenberg, I was hooked. That seems silly to say – Gutenberg is not perfect yet, and the writing experience on other CMSs/platforms has probably been just as nice for some time.

But that’s the thing: I hadn’t written in years. I came to Gutenberg with a nearly-clean slate and no preconceptions (excepting that I never really loved TinyMCE), and I immediately fell in love with the new editor.

So naturally, as I was pulling together the rough drafts and ideas I had for my book on WordPress freelancing, I decided to actually write the book in WordPress.

I don’t want other people’s grubby hands on my content

There’s lots of software for writing books (even some powered by WordPress), but the book content was precious to me – I didn’t want to leave it in the hands of a 3rd-party provider. I don’t want Jeff Bezos stealing my content for his book (I have my doubts he would do such a thing, but still), and I wanted the content to be portable in case I decide down the line to export to some new format.

I also needed to be able to rearrange & modify content willy-nilly. If I was using someone else’s software, I’d be limited to the options they provided. With my own self-hosted WordPress install, I could add CPTs, write my own shortcodes, use hooks & filters, add custom blocks – in a word, I could do anything I wanted with my writing.

My brain works better with HTML & CSS

5 years ago, I was very proficient with Photoshop; I could make it do what I wanted. But 5 years is a long time to let your skills rust, and I felt the creaks: I couldn’t do the most basic tasks like rounding the corners on images without help from a tutorial. However, rounded corners are a one-liner in CSS.

CSS! Oh, what a joy CSS is. My mind works in CSS. When I see a billboard driving down the highway, I see the float: right; and line-height adjustments I would use to convert that billboard to a website.

.billboard:after { content: “.”; display: block; position: absolute; left: 40px; top: 30px; color: #888; font-family: sans-serif;}
Photo by Paweł Czerwiński on Unsplash

If your brain sees paintings as front-end languages, WordPress gives you the canvas and the brushes you need to paint it.

My designs will never be very pretty, but it’s pleasant to format pages and add nice touches in HTML & CSS. Gutenberg + WordPress give me all the power I needed.

Local by Flywheel is amazing

I’m ashamed to say I hadn’t tried Local by Flywheel before this book. In the past, I’d used VCCW or other Vagrant-based setups to spin up development machines. While it worked, it was not the same easy, breezy experience that Local provides. What an amazing piece of software! I was up and running with a development site (http://book.local) in under 5 minutes.

Gutenberg handled copy + paste brilliantly

I had written many chapters for the book in markdown, and I dreaded the task of converting my writing to Gutenbergese. But it was no problem at all!

First, I rendered the markdown as HTML. Then I copy + pasted the HTML straight into a blank WordPress page, and Gutenberg converted all of the content into the appropriate blocks, without issue.

This saved me heaps of hours, and it was a moment of pure joy to see my crude markdown drafts become lovely blocks, styled according to my theme – all in 1 copy + paste.

I used OceanWP because it’s so dang customizable

In years past, I didn’t like the idea of HUGE amounts of options for themes. But as I’ve done more client work, I’ve come to see the advantages of “blank slate with a bazillion options” themes like OceanWP. I was introduced to OceanWP by my friend Tyler, who has used it in many of his “how-to” tutorial videos on YouTube.

I was able to:

  1. Strip OceanWP down to a clean look that I liked
  2. Configure the typography
  3. Make some basic CSS changes

…all in a matter of minutes, not hours. I’m pretty efficient with CSS, but having lots of fine-grained control via the Customizer panel means that I can see changes quickly and get it 90% done in a quick pass.

Writing was really nice

Did I tell you Gutenberg is a joy?

Being able to drag blocks around and reuse sections of content is a massive productivity booster. Being able to escape the TinyMCE window and have things like columns work “out of the box” made writing a pleasurable experience.

Gutenberg still has oddities I fought with. For example, I still have difficulty with things like transitioning from a list to a paragraph after copy-pasting content into the list. The UI needs some polish to handle these edge cases, but I largely didn’t have problems – and for the ones I did, I found workarounds quickly.

Regular old Pages did the trick

If I had more time, I would have created custom post types for the different elements of the book: Chapters, Topics, Project Types, Successful Freelancer Profiles, etc. Then, I could lay them out neatly on some custom templates and I wouldn’t have to deal with a bunch of nested pages.

But I was short on time, so I just wrote my content in a bunch of Pages using the default Page template. I nested pages to delineate chapters and topics, and used the order value to keep them straight in the WP admin.

To style the different content I applied CSS via .page-id-123 selectors written in a child theme. Duplicating Pages using the always-handy Duplicate Post plugin meant I could reuse content with a similar layout (such as the profiles of successful WP freelancers).

Merging it into 1 big book was a pain

Since each Page was it’s own document, I had to find a way to join them all together into a gigantic PDF. I thought about writing a custom template and outputting the title/content/whatever into 1 big HTML document, but that seemed very error-prone to me. The WordPress theme relies on IDs for things like #content, which would be duplicated for each Page unless I did some custom coding. Too much work for this little book!

Instead, I build the PDF the old-fashioned way:

  1. I open each page in a new tab by holding Cmd and clicking “View” from the WP admin
  2. I hit Cmd + P to open the print dialog in Chrome
  3. I choose “Save as PDF” and save all the PDFs in the same folder
  4. I go to the folder in Finder, select all of the PDFs, and drag them into my text editor, which gives me just the filename
  5. I wrote a little bash script that uses Ghostscript to concatenate the PDFs. I provide the filenames from the last step to Ghostscript for concatenation

Here’s the command to generate the book:

This is a big manual process and a huge pain! Ideally, I could simply export my pages via a plugin. I tried Anthologize (hat tip David Bisset), but it was too limited stylistically for my tastes.

I’m sure I could make this process more efficient, but given that I’m only going to put out a new version every so often, it wasn’t worth it to optimize this process for me.

Table of contents was also a pain

Anchor-based links like <a href="#page-2"> don’t work when merging PDFs together like I did, so I had to find another way. I finally just spent $19 to get access to Acrobat Pro so I could build the table of contents manually. Small pain, but it took all of 15 minutes and is easy to edit later.

I sold the book with Easy Digital Downloads

I very nearly went with Gumroad to sell the book (not WordPress, impure!), because I was operating with limited time and needed to start selling ASAP.

Funnily enough, I spent more time battling with Gumroad to make it work like I wanted than I did configuring Easy Digital Downloads to sell it on my own site!

Gumroad makes it a point to be “easy” to sell, but I really didn’t like how the checkout process looked – the button styles didn’t match my site, Gumroad floated the payment screen off to the right, I wanted it in the center, etc.

Easy Digital Downloads was wonderful to configure and modify to my liking. Besides, I’ve learned so much from Pippin and his team, it felt good to spend my money supporting such a top-notch developer in the WordPress ecosystem.

Overall: That was pretty easy

There were a few hiccups in publishing my book, particularly during the “export” to PDF. However, I’d start the whole process over again in WordPress if I ever wanted to get started with a new book. The ease of writing in Gutenberg and the ability to customize the site to my liking (using the language I know and love) is well worth the small hassle of converting to PDF. I hope this helps if you decide to do the same!

This Post Has 2 Comments

  1. I’m using Gumroad for my website at https://metabox.io. You can style the button the way you want by removing Gumroad’s CSS class and you can set data-single-product=true to make it opens the overlay at the center of the screen.

    I found it super easy and sufficient when you don’t need a back end.

    1. Thanks for sharing your experience! I battled with Gumroad for a little bit (including data-single-product) but just couldn’t get it to work like I wanted. Probably my shortcoming, not theirs.

Leave a Reply

Close Menu