Skip to main content

Catalogues

A catalogue is a kind of post of your own: cars, homes, venues, a gallery of sites. It has its own name, its own address under the community, its own fields and categories, a menu item, a form to add one in a few steps, a page for each post and a My page for its owners. It runs on the same engine as Listings, so it has the same directory with its search and filters, the same stepped form, how long a post stays up, approval before publishing and reviews.

There are two ways to make one. You make it on Settings → Catalogues to try it on the site, and when it is right you take it as code, where it belongs. Or you write it in code at once.

Settings → Catalogues​

Settings, Catalogues: Cars at /cars/ marked In code, Boats at /boats/ marked Prototype with its Edit, Take as code and Take away, a note on what a prototype is, and New catalogue
Settings → Catalogues

The screen lists every catalogue the site has, with its address. A badge says where it comes from:

  • Prototype: made on this screen. It runs on the site as it is, with real posts, search and pages. The screen warns that it is a prototype, and that when it is right you take it as code so it is kept with your code.
  • In code: declared by a plugin or your site code. It is read here and not edited here.
  • Now in code: a prototype whose name your code now declares. The code wins, the prototype is no longer read, and the screen lists what the code says differently.

A prototype has Edit, Take as code and Take away. Taking one away removes its pages. Its posts stay and show again if a catalogue of the same name comes back, here or in code.

A new catalogue​

The New catalogue dialog: Name in code, One is called, Several are called, Address, Categories, Form steps, Up for, Members review them, A tab on their owner profiles, and Fields with Add a field
New catalogue

New catalogue asks for:

  • Name in code: small letters, such as car. It never changes, because posts are kept by it. It can't be a word the community uses, such as post, event or job.
  • One is called and Several are called: Car and Cars. The pages take their words from these, such as New car and My cars.
  • Address: under the community, cars for /cars/. Left empty it is the name and an s. It must differ from the name.
  • Categories: one on each line, and a line starting with - goes inside the one above. They are made once, then yours to change on the page of the catalogue under Settings → Components, in its Categories.
  • Form steps: Category, Photos and Place can be turned off. Details and Review always stay.
  • Up for: 7 days up to 365, or Until taken down.
  • Members review them and A tab on their owner profiles.
  • Fields: each has a name in code, a label and a type: short text, paragraph, number, money, date, link, phone, email, dropdown, choice, checkboxes, yes or no, or a link to another post. Dropdowns, choices and checkboxes take their options one a line. A link can point to any post, to members or to another catalogue, with what the other side calls it. Each field can be Required, A filter in the directory, and shown On cards.

Taking it as code​

Take it as code: a PHP snippet of the catalogue with Copy and Download as a plugin
Take as code

Take as code shows the catalogue as PHP. Copy it into your site plugin or a mu-plugin, or Download as a plugin to upload a one-file plugin. Once the code declares the name, the code wins and the prototype is no longer read. The posts stay.

Declaring a catalogue in code​

Declare it on poly_community_register_catalogs:

function register_car_catalog( $catalogs ) {
$catalogs->register( 'car', array(
'label' => 'Car',
'plural' => 'Cars',
'icon' => 'car',
'path' => 'cars',
'nav' => array( 'after' => 'members' ),
'profile' => true,
'fields' => array(
'price' => array( 'label' => 'Price', 'type' => 'money', 'role' => 'price', 'card' => true ),
'fuel' => array( 'label' => 'Fuel', 'type' => 'radio', 'options' => array( 1 => 'Petrol', 2 => 'Diesel', 3 => 'Electric' ), 'search' => true, 'card' => true ),
'year' => array( 'label' => 'Year', 'type' => 'number', 'search' => true ),
),
'categories' => array( 'Cars' => array( 'Small', 'Family' ), 'Vans' ),
'steps' => array( 'category', 'details', 'photos', 'place', 'review' ),
'lifetime' => array( 'days' => 60, 'renew' => 'free', 'remind' => array( 3 ) ),
'labels' => array( 'new' => 'Sell a car', 'mine' => 'My cars' ),
) );
}
add_action( 'poly_community_register_catalogs', 'register_car_catalog' );

The name is 2 to 20 letters, and the address is another word than the name and not one the community uses. A declaration that is refused is not registered. The other settings are:

  • nav: after names the menu item it follows, and false leaves it out of the menu.
  • profile: a tab of it on the profile of its owners.
  • steps: any of category, details, photos, place, contact and review.
  • lifetime: days, renew and remind, or false for posts that never end.
  • review: approval before publishing, off, first or every.
  • reviews, alerts and contact: reviews, saved searches and ways to reach the owner.
  • view: list or map, what the directory opens on.
  • labels: the words the pages say, such as new, mine, edit, empty, made from the name where you give none.

A catalogue in code is read from the code, with nothing kept in the database while it stays as declared. The code wins over a prototype of the same name.

On the site​

Cars before anyone listed one: its search, Filters and Sort, Nothing is listed here yet, Be the first to add one, and Sell a car
A catalogue on the site: Cars

A catalogue adds its directory at its address, a page for each post, and My posts for its members, and a menu item unless you left it out. The directory has search, the categories as chips, and Filters for the fields marked as filters.

Sell a car, step 1: What are you listing? with the categories as tiles
Sell a car

Adding one goes in the steps you chose, each saved as it is done, ending with a last look and Publish.

Changing Catalogues​

The pages of Poly Community are drawn by the browser from data: one file of each page for every reader, and one answer of data when a member moves to it. Keep a change to a catalogue that way, so its directory and posts stay fast. Pages drawn from data gives the rules, the API and a recipe for the page of one item.

  • Showing more on a post: data and a template, never HTML drawn for one reader. Register a part on poly_community_register_page_data whose answer returns data, and bind it in a template with state.partHere. What one reader alone may see goes in a part or shows by a fact. wp poly-community page-data list shows the pages and wp poly-community page-data check <page> says whether a page is one drawing for a visitor, a member and an administrator, and what to change if it is not.
  • With a coding agent such as Claude Code, Codex or Gemini CLI: give it the page above and ask for the change in its words, then have it run the check. For example: "In Poly Community, show how many cars the owner lists on the page of a car as a part registered on poly_community_register_page_data, its answer returning data and its template binding state.partHere. Draw no HTML for one reader in PHP. Run wp poly-community page-data check on the page and fix what it reports."
  • In the admin: Settings → Catalogues, the page of each catalogue under Settings → Components with its settings and Categories, and Settings → Words for any of its texts.

Changing a component sets out the ways every component changes.