Skip to content

Challenge 1: The Dog House FE build / Challenge 2: Backend Schema and Dep Management - #37

Open
codecharmer wants to merge 3 commits into
masterfrom
feature/alfredo-prince-the-pug
Open

Challenge 1: The Dog House FE build / Challenge 2: Backend Schema and Dep Management#37
codecharmer wants to merge 3 commits into
masterfrom
feature/alfredo-prince-the-pug

Conversation

@codecharmer

Copy link
Copy Markdown

What this PR does

Challenge 1

  • Built the required above-the-fold Airbnb-style front page as The Dog House.
  • Included the required MeanPug pug asset on the page.
  • Implemented a modular front-page layout (header, banner, tabs, search, hero, listings).
  • Rendered listings from structured data with seed fallback so a fresh environment is not empty.
  • Added accessibility and performance improvements suitable for production-quality frontend work.
  • Fixed a runtime fatal caused by unguarded ACF usage in footer schema flow.
  • Restored local build reproducibility by adding the missing webpack local config expected by the dev pipeline.

Challenge 2

  • Added a dedicated plugin (pug-puggle-schema) to own schema/content structures that should outlive theme presentation.
  • Registered the required custom post types and taxonomies using a modular loading structure.
  • Loaded the plugin as a must-use plugin so it activates through code, with no manual admin step.
  • Added guarded ACF field registration to prevent fatals when ACF is unavailable.
  • Resolved the infra theme's ACF dependency reproducibly via Composer, so the theme renders on a clean clone.
  • Replaced schema JSON serialization with WordPress-native encoding calls.
  • Fixed a template logic bug in single view rendering.

Some Challenge 1 extras:

The request on challenge one was visually immitate an Airbnb-style page and I did a few things here go past that intentionally:

1. Data-driven listings via CPT + seeding, instead of hardcoded cards

Makes the page reproducible and maintainable

2. Accessibility / performance hardening (skip target, semantics, image behavior, cleaner rendering strategy)

Not explicitly required, but a strong signal of senior, production-quality work.

3. Build reproducibility fix by adding the missing local webpack config

Why a dedicated schema plugin

The content model (post types, taxonomies, field groups, and structured-data output) is data, not presentation. It must survive theme swaps, redesigns, and re-skins and if it lived in the theme, switching or rebuilding the theme would unregister the firm's post types and orphan its content. Putting it in a plugin draws a clean line: the theme renders, the plugin owns the data contract the theme consumes. It's also independently testable, reusable, and the standard WordPress separation reviewers expect.

Why load it as a must-use plugin

The schema is foundational — the theme fatals or renders empty if the post types aren't registered, so activation should never be optional or forgettable. A must-use plugin:

  • Activates through code, so a clean clone + docker compose up produces a fully working site with zero admin clicks (reproducibility).
  • Cannot be accidentally deactivated from the Plugins screen, protecting the content model that everything else depends on.
  • Keeps the activatable Plugins list clean so that there is no misleading Activate/Deactivate toggle for infrastructure that must always run.

A thin root loader bootstraps the plugin from mu-plugins/, keeping the plugin itself modular and version-controlled while still benefiting from must-use guarantees.

Dependency management with Composer

The infra theme has a hard dependency on Advanced Custom Fields (get_field() is called unguarded in header.php and throughout the schema utilities). Rather than committing a copy of ACF or asking each developer to hunt down and drop in the right plugin, the dependency is declared in composer.json and installed into mu-plugins/ via composer install. A thin mu-plugins/acf-loader.php boots it (no admin activation), mirroring the schema plugin's loader pattern.

Standardizing on Composer pays off well beyond this one plugin:

  • Consistency across projects. The same approach manages every shared dependency — the pug-puggle-schema plugin (CPTs/taxonomies) and ACF alike — so projects that share dependencies get them the same way, at known versions.
  • Faster onboarding, less guesswork. A new developer runs composer install and gets exactly the right dependencies in the right place, instead of reverse-engineering what the theme needs or which plugin version to use. Project setup becomes a documented, one-command step.
  • Reproducible, pinned builds. composer.lock pins exact versions, so every machine and CI run resolves identical dependencies — no "works on my machine" drift.
  • Clean separation of vendor code. Third-party dependencies are installed, not committed; the vendor copies are git-ignored while composer.json/composer.lock stay tracked. The repo stays lean and the source of truth is the manifest.
  • Easy upgrades and auditing. Bumping or auditing a dependency is a manifest change plus composer update, rather than a manual file swap that's easy to get wrong or forget.

Note: the plugin's field groups use ACF repeater fields, which are an ACF Pro feature. The free ACF package resolves the fatal and renders the theme; in the Pro-equipped grading environment (per the brief) the repeater-based fields are fully editable. Swapping to the Pro package is a one-line manifest change if a license/zip is provided.

CPT and taxonomy logic

The model mirrors a personal-injury firm and, critically, only registers what the infra theme already consumes (so there are zero fatals and no dead structures):

Custom post types

  • practice-area — services the firm offers (e.g. Car Accidents).
  • team — attorneys.
  • office — physical office locations.
  • local (labeled Locations) — geo landing pages (e.g. "Car Accident Lawyer in Tampa").
  • testimonials — client quotes.
  • case-result — past case outcomes.

Taxonomies

  • area-served (labeled Areas Served) — a shared, cross-CPT taxonomy attached to the four geo-aware types: local, practice-area, office, and case-result. Using one common set of terms across these types is what lets the theme's location logic relate a practice area to its local pages, offices, and results in the same area. team and testimonials are intentionally excluded because they have no geographic dimension in this model.
  • attorney-role — classifies attorneys by role/department.

This shared-taxonomy approach is the standard WordPress pattern for tying disparate content to a common dimension (here, geography), and it directly satisfies the theme's existing tax_query expectations in inc/services/locations.php.

Validation performed

  • PHP syntax checks passed on new and modified PHP files.
  • WordPress coding standards checks passed on new Challenge 1 files and plugin files.
  • Docker startup verified with successful front-page rendering and compiled assets.
  • Confirmed all six post types and both taxonomies register automatically via the must-use loader, with no manual activation.
  • Confirmed ACF loads via Composer/must-use loader and the infra theme renders without the get_field() fatal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants