WP SSR Framework replaces the usual tangle ofDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Ahondev/portfolio-v2/llms.txt
Use this file to discover all available pages before exploring further.
register_post_type(), register_taxonomy(), and ACF field group calls with a single fluent builder: PostType::create(). One chain of method calls registers the post type in WordPress, wires up the ACF Extended field group, generates the EloquentCPT model class, and exposes a type-safe query interface — all without touching the database or the WordPress admin.
Defining a Post Type
Post types are defined in PHP files underconfiguration/posts/. Each file is included automatically when the framework boots.
PostType::create()
The WordPress post type slug (e.g.
article, service). Must be unique — calling create() on an already-registered slug triggers wp_die().Singular label shown in the WordPress admin menu.
Plural label used as the post type’s
label argument.URL slug used for the WordPress rewrite rule (e.g.
blog, services). This value should match the base path registered in your web routes.Dashicons suffix without the
dashicons- prefix (e.g. hammer, art, welcome-write-blog).When
true, the framework registers SEO meta fields (seo_title, seo_description, seo_keywords, seo_author) for this post type. These are automatically picked up by WebController::view().Optional. The short class name of the auto-generated EloquentCPT model (e.g.
Article). When omitted the framework uses the slug as the class name.Chainable methods
->taxonomy()
Registers a WordPress taxonomy associated with the post type. Pass an optional $fields array to attach an ACF Extended field group scoped to the taxonomy terms.
->fields()
Appends ACF Extended field objects to the field group that will be registered for this post type. Use any field type from the Extended\ACF\Fields namespace.
->make()
Finalises the definition by calling register_extended_field_group(). You must call make() at the end of every chain.
Real-world examples
EloquentCPT — the model layer
PostType::create() registers the post type slug with EloquentManager, which auto-generates a lightweight model class in app/PostTypes/. Each generated class looks like:
EloquentCPT class maps all standard WP post fields plus every ACF field to typed properties automatically in its constructor via initACFFields():
toArray()
Serialize a model instance to a plain PHP array — useful for JSON encoding or passing to a view:
Querying with QueryBuilder
Use the staticquery() method on any EloquentCPT subclass to start a fluent query:
Common query methods
| Method | Description |
|---|---|
->all() | Fetch all published posts (no limit) — shorthand for ->limit(-1)->get() |
->limit(int $n) | Cap results at $n posts |
->offset(int $n) | Skip the first $n posts |
->orderBy(string $field, string $order) | Order by any field; use the ASC or DESC constants |
->random(int $n) | Return $n posts in random order |
->where(string $key, string $op, mixed $value) | ACF meta query; operator can be =, !=, >, <, LIKE, etc. |
->orWhere(...) / ->andWhere(...) | Combine meta conditions with OR / AND relation |
->taxonomy(string $taxonomy, string|array $term) | Filter by taxonomy term slug |
->with('taxonomy', 'category', ...) | Eager-load taxonomy terms in one optimised SQL query |
->search(string $query) | Full-text WordPress search |
->matchIds(array $ids) | Fetch specific posts by ID |
->matchSlugs(array $slugs) | Fetch specific posts by slug |
->get() | Execute the query; returns an Illuminate Collection |
Querying taxonomy terms
['id', 'name', 'slug'] maps, filtering out the default “Uncategorized” term automatically.
Usage in a controller
->all() is a shorthand for ->limit(-1)->get(). The return value is always an Illuminate Collection, so you can chain ->map(), ->filter(), ->pluck(), etc. before passing data to a view.