1. Home
  2. Docs
  3. BookPress
  4. 4.0 Shortcodes
  5. 4.2 Book ‘Library’ Shortcode (Paid Plugin Only)

4.2 Book ‘Library’ Shortcode (Paid Plugin Only)

 

You can display all your published books with our powerful ‘library’ shortcode.

Fig. 1 – Basic Library Shortcode

You can also add parameters to the shortcode to further control what is displayed. These parameters are:

  • ‘genre’ => genre slug (with comma for multiple genres)
  • ‘id’ => book id (with comma for multiple ids),
  • ‘exclude’ => book id (with comma for multiple ids)
  • ‘orderby’ => orderby (default title)
  • ‘order’ => sort ASC or DESC (default DESC)
  • ‘section_title’ => Section title (add your own text)
  • ‘max_post’ => maximum number of books to display

Note: to find your book’s Genre and Book ID check out the listing on the main book listing page (see the sidebar menu link: BookPress => All Books).

When using these parameters, your shortcode will look something like this:

Fig. 2 – Library shortcode with example parameters.

The ‘order’ paramater can be set to use any of the standard WordPress strings/arrays found here https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters although most of these are not relevelt to the BookPress posts – we suggest the most relevent are: ID, author, title, name, date, modified, rand.

Once save/published the shortcode should generate content that looks something like this:

Fig. 3 – Library shortcode displaying four books (left side of page above)


Note:  The shortcode does not support pages and posts using the Gutenberg editor.  Please switch to the Classic WordPress editor if using shortcodes.

You can use the official WordPress plugin to manage this – https://wordpress.org/plugins/classic-editor/

Was this article helpful to you? Yes 2 No