WordPress snippets

WordPress code snippets.

Practical WordPress snippets from real client builds, written to drop into production themes, child themes, and custom components.

WordPress
Beginner-friendly

Project Category Archive Navigation with 4 Column Grid

Build a project archive with an All link, project_cat term navigation, active archive classes, and a responsive 4 column project grid using native WordPress archive queries.

Use this when you want each project category to have its own… ~8 min setup
View snippet
WordPress
Beginner-friendly

WordPress Archive Query — pre_get_posts Control PHP

A focused pre_get_posts helper for changing archive page sizes per post type without touching admin screens, secondary queries, or unrelated blog archives.

Useful when your theme has multiple post type archives that need different… ~4 min setup
View snippet
WordPress
Beginner-friendly

WordPress Custom Post Type — CPT Registration PHP Boilerplate

A clean, well-commented boilerplate for registering custom post types in WordPress — with proper labels, REST API support, archive configuration, and filter hooks for child theme overrides.

Use this when you're building a WordPress theme that needs custom content… ~5 min setup
View snippet
WordPress
Beginner-friendly

WordPress Custom Taxonomy Registration

Register a custom taxonomy in WordPress using register_taxonomy() — hierarchical (category-like) or flat (tag-like), with full i18n labels, REST API support, and permalink slugs.

Use this when your custom post type needs grouping or filtering —… ~5 min setup
View snippet
WordPress
Beginner friendly

WordPress register nav menu PHP – Custom Navigation

Register a custom menu location with register_nav_menus(), then render it in your template with wp_nav_menu(). Includes fallback handling and a full production header nav.

Use this whenever you need a custom header, footer, or sidebar navigation… ~5 min setup
View snippet
Chat on WhatsApp