Context: B2B commercial professional (not a programmer) using AI as a copilot to build business tools. This is the search engine for Guia Brasileiros na Espanha, a B2B directory with 97,000+ active members.
A directory with hundreds of listings needs a fast way for visitors to find who they're looking for — by city and service category — without relying on WordPress' generic search, which doesn't support that level of filtering or prioritize premium-tier listings.
Directory visitors (Brazilians in Spain looking for a specific professional/service) and, indirectly, premium listers, who need guaranteed visibility in search results.
A results page that filters listings by city and category (via query string, coming from a search form) and reorders results so premium-tier listings always appear first — without a separate query or "sponsored" logic bolted on. The reordering happens in memory: IDs returned by the main query are split into two groups (premium / regular) and re-fetched in a second query with post__in, preserving that order.
Search form (city + category)
↓
Input sanitization (sanitize_text_field + anti-injection regex on category)
↓
WP_Query on the "anunciante" custom post type (up to 50 results, meta_query filter)
↓
In-memory split: premium[] vs regular[]
↓
Second WP_Query respecting the premium → regular order
↓
Responsive grid (pure CSS, no JS) with photo, category, city, direct WhatsApp button
- WordPress (Astra child theme —
astra-child) - Native PHP (no framework)
- WP_Query / Custom Post Types / Custom Fields (ACF-like:
cidade,categoria,plano,whatsapp,foto_do_perfil,descricao_curta) - Inline CSS (no build step dependency)
Search engine in production, used by the directory's 97,000+ members. The Guia's real customer acquisition cost: €8 vs a €15 target — the search engine is one of the pieces that sustains retention once someone joins the directory.
- Requires WordPress with Astra + a configured child theme
- Create an
anunciantecustom post type with the fields:cidade,categoria,plano(premium/regular),whatsapp,foto_do_perfil(attachment ID),descricao_curta - Place
page-buscar.phpinwp-content/themes/[your-child-theme]/ - Create a WP page with the slug
buscar(or rename the template per WordPress' template naming convention) - Point the search form to that page, passing
cidadeandcategoriaas GET parameters
- Migrate category/city filtering to semantic search (intent matching, not just exact string)
- Pagination (currently capped at 50 results, no pagination)
- Query caching to reduce load during traffic spikes
Built with Claude as a development copilot.