Using Customizer API vs Custom Meta Box for custom content

Neither!

Neither of these really make sense

Why Not A Metabox/Post Meta?

What you’re describing is not an attribute of a page, so it doesn’t make sense as post meta shown in a metabox.

Additionally:

  • You can’t link directly to post meta
  • Adding post meta to site search is difficult, and makes search 100x slower
  • And if you did manage that, users wouldn’t see the service they wanted, they’d just see the generic services page
  • You’d have to write all the code to store and save it, then write it all over again to display it. Plugins can make it easier but it’s still a pain in the arse
  • Only your theme would be able to display the data
  • Metaboxes are kind of legacy meh with the new block editor. It’s all about custom blocks and sidebar panels now

Why Not A Control In The Customizer?

It also isn’t a site wide control to customize how your site behaves and looks, so it doesn’t go in the customizer! Besides:

  • Those get stored as options and theme mods, so it doesn’t scale as the list of services gets longer
  • The newer iterations of the block editor are introducing the full site editing interface that replaces the customizer
  • It’s not easy to develop for

What you’re describing is content.

So, you have 2 options that depend on just how in depth your services are.

Page Content

If you’re literally just listing them all on a page, why not just have a services page that lists them? You could use column blocks to do the classic image on the left, text on the right thing, cover blocks if you wanted a whole section, or even build your own block!

But, if you want to be able to link to a specific service, or have an entire page for a service, the next option would be better suited

A Service Custom Post Type

Use register_post_type to register a service post type. You’ll get lots of free stuff ( they can be turned off when calling register_post_type too:

  • You’ll get an archive to list services at /services ( configurable )
  • Free templates ( single-service.php and archive-service.php anybody? )
  • An entire new section of WP Admin in the sidebar dedicated to Services
  • Free REST API endpoints ( set show_in_rest to true )
  • RSS feeds!
  • Dedicated URLs ( yoursite.com/services/gardening? )
  • Basic integration with SEO plugins
  • Post meta! Now you can have featured images and all sorts of information about the services stored. So much more flexibility
  • Child posts! What if your services had sub-services? Perhaps that gardening service has multiple specialities to hire

With a CPT, you could even register a custom taxonomy to organise them! Wouldn’t it be nice to have a Service Type taxonomy? A County taxonomy for where the services are available? With their own URLs! yoursite.com/services/county/derbyshire?

On top of all that, if you put the registration code in a plugin, the services post type will work with every theme!

tech