KS Services WordPress Plugin

Завдання Give the services catalogue its own content type, so replacing the theme cannot take it along — and publish the result for anyone building a services site on WordPress.

Every business site lists its services, and nearly every one keeps that list inside the theme — so the day the theme goes, the catalogue goes with it. KS Services gives the catalogue its own content type: services with icons, subtitles, questions and prices, in categories that hold their order. Published as open source under GPLv3.

Вихідники, задачі та релізи на GitHub

Nothing here is written for one site

Slugs, entity names, listing size, ordering and the menu icon are settings; the icon set, the templates and the schema output are filters. The plugin ships a plain default for each of its three screens, and a theme takes any of them over by having a file of the right name — no registration, no setting to switch.

One boundary is respected on purpose: a template more specific than the generic archive is somebody’s explicit answer for that page, and the plugin leaves it alone.

What a service carries

An icon, a subtitle, a block of questions and answers, and a price. The icons are symbols in an SVG sprite — sixteen ship with the plugin, and a theme adds its own set through a filter rather than by replacing files.

The icon resolves by inheritance: the service’s own symbol if one is assigned, the first category’s if not, and a fallback when the id does not exist — so a listing never renders a hole where a glyph should be.

Lists that keep their order

Services and categories are both ordered by dragging, in the same list tables they are edited in, and every listing respects that order. The order a business puts its services in is information — alphabetical is almost never it.

The listings themselves come as a shortcode and a block that render identically: by category or across all of them, limited or not, one to four columns, services or the categories themselves.

Search reads the same page

Each service emits JSON-LD: the service itself, an offer when a price exists, and a question block when there are questions. All of it can be switched off — per service, or globally through a filter — and the default currency is a single setting both the page and the markup read, so the two cannot disagree.

Чого навмисно немає в налаштуваннях

The URL slugs are editable; the post type and taxonomy names are not. Those names are the strings every record is filed against — offered in a settings screen they would be a one-click way to lose a catalogue, because renaming one leaves the existing services filed under a type nobody registers any more. They can still be set from the site configuration file: before the first service exists, and never after.

Як він влаштований усередині

Namespaced classes with modern autoloading, and each hook declared on the method that answers it rather than in a registration list somewhere else. The API a theme calls is one class with one import, guarded so a site without the plugin degrades instead of failing.

No runtime dependencies, so the repository runs the moment it is cloned; the development tooling installs apart from the plugin and can never reach the autoloader that ships. Before a release: static analysis, coding standards against the WordPress ruleset, unit tests, and a CI that refuses a commit whose shipped autoloader disagrees with the source.

Ролі

Розробник
Konstantin Sorokin

Виконано
  • Post type, hierarchical categories and the service fields: icon, subtitle, FAQ, price
  • Drag ordering for services and categories, respected in every listing
  • A shortcode and a block that render the same listing
  • JSON-LD for the service, the offer and the questions, with per-service and global switches
  • Settings screen for the slugs, the naming, the archive and the menu icon
  • Static analysis, WordPress coding standards, unit tests, CI