Themes root - Main page: suggestions

I think we ned a place for each theme. That is the place for Book root (the catalog in the site 1). We could create varations of Pressbook publisher and the users we could use the one fits better to our site. Ring now, the one we have is pretty simple.

What do yo think about something like that?

As a categories, some keywords (maybe selected by the administator, otherwise, can bee too many). And in other place, maybe a filter with all of the keywords.

http://demo.slicejack.com/#pine/

1 Like

Take a look that theme. Instead of post, books.

https://demo.wallacetheme.com/

other idea for the catalog
https://es.scribd.com/search?page=1&content_type=tops&query=dele%20a2

and the wordpress version

maybe also : https://www.smashingmagazine.com/2013/01/frank-a-wordpress-theme-designed-for-speed/

Also maybe we can not just redirect to the book, also to open a page with more information about the books.

How about a simple short-code, which works in every theme? :slight_smile:

It could be a good idea. @ned, what do you think?

To create a portfolio like plugin…

A shortcode which lists books? It’s hard for that to be simple—there’s so many decisions to be made as to how you would display each book that I don’t think a shortcode is good for it. Do you want the cover? Do you want the title and author on separate lines? On the same line? Do you want other metadata displayed? Do you want rich markup for each book’s representation in HTML (e.g. Schema.org data)? You might as well write your own function at that point.

This is a good reference point for how we load the catalog of books into the front page of Pressbooks Publisher.

	$args = apply_filters( 'pb_publisher_catalog_query_args', array( 'public' => '1' ) );
	$books = new WP_Site_Query( $args );
	foreach ( $books->sites as $book ) {
		if ( get_blog_option( $book->blog_id, 'pressbooks_publisher_in_catalog' ) ) {
			switch_to_blog( $book->blog_id );
			$metadata = pb_get_book_information();
			restore_current_blog();
			// Display here
		}
	}

This code gives you:

  1. The WP_Site object for your book, $book (see here);
  2. An array of Pressbooks’ book information, $metadata.

With those two pieces of data, you can build the display for your book.

1 Like

We will use that code as a reference and we will make a pinterest style theme.

I think it will be the most flexible option and the faster way to create it.

Just be aware that dynamically loading books (e.g. infinite scroll) will likely have really poor performance because of the way multisite is built. See here: Approaches for a complete sites endpoint and an expanded WP_Site_Query – Make WordPress Core

When home, siteurl, blogname, or post_count is requested, the site uses switch_to_blog() and get_option() to populate the data from the individual site’s options table. If 25 sites are on the list, this generates 25 context switches and accesses 25 different tables.

Ok. Thanks ned. we will tak a look.

we are thinking to use as base the theme http://demo.designwall.com/#dw-wall

And to have categories for books (as much as possible in a controlled way). In that way the number of books in each category it will be not too big and the performance will be better. If we use Categories and tags, the number of resoults in each search it will be even much litle.

( Always we could have number of pages instead of infinite scrooll )

Waht if we do create a table in the DB where we save all the sites we have with all the key information. In that way we will just go to one table. Don´t you think?

Or to create a custom post type in the Root theme where for each site we do create a custom post with the information.

Which option do you like the most?

Neither of these are good ideas. If you read the linked post from Make WordPress Core, you will see that the core developers of WordPress Multisite are currently working on approaches to solving this problem. Building your own solution would be complex, costly (in terms of your developer’s time) and ultimately will be made redundant in the near future. I would suggest that you follow the related Core Trac issue, https://core.trac.wordpress.org/ticket/37923, and take advantage of the core functionality when it is merged in. This may delay your project, but it will be worth it.

1 Like

For the filters of the books.

Should we use the metadata (of the site) we are working with or must be something different?

You would probably want to fetch the book information using \Pressbooks\Book::getBookInformation() and use the metadata from there for filtering/sorting.

We do this already, in fact: https://github.com/pressbooks/pressbooks/blob/dev/themes-root/pressbooks-publisher/templates/content.php#L14