Skip to content
WordPress Setup & Basics

Complete Sonnet 4 WordPress Directory Guide for 2026

Copy Any Website Template for Your WordPress Directory Using Sonnet 4

You can build a WordPress directory website without coding every listing page from scratch. Use a Claude Sonnet coding assistant to draft an original theme from design screenshots, then add custom fields and import business listings from a source you are allowed to reuse. This guide uses a US law firm directory to show the workflow, from theme setup to data checks and launch.

Quick Answer

To build a WordPress directory website with Claude Sonnet, choose a design reference, define your listing fields and locations, generate and test a custom theme, then import licensed or permitted business data with an XLSX-compatible plugin. Check every listing and page before launch. AI speeds up drafting but does not replace testing or data verification.

The original project used Claude Sonnet 4, GFast Scraper, Advanced Custom Fields (ACF), and a spreadsheet importer. You can follow the same steps with a currently supported coding model and a data source that permits directory publication.

Key Takeaways

  • Start with a directory-style inspiration site that matches the structure, layout, and browsing experience you want.
  • Collect business data only when the source and applicable rules permit reuse, then clean an XLSX file before importing.
  • Give your Claude coding assistant exact theme, post type, taxonomy, field, and US-location requirements.
  • Keep listing post types in a plugin, use ACF for details, and confirm your importer supports XLSX and ACF mapping.
  • Test a small import, then review location pages, listing accuracy, mobile layouts, and search before launch.

At a Glance

Best ForWordPress users who want to build a niche directory faster with AI-generated theme files and imported listing data.
DifficultyIntermediate. You should be comfortable with WordPress, themes, plugins, local testing, and basic troubleshooting.
Tools NeededVisual Studio Code, Local WP, an available Claude Sonnet coding model, permission-cleared business data, ACF, and an XLSX/ACF-compatible importer.
Main GoalCreate a custom WordPress directory with listing pages, taxonomy archives, images, business details, and a design inspired by your screenshot reference.

Example law firm directory homepage used as a visual layout reference

How to Plan Your WordPress Directory and Prepare Data

Choose a directory site with the search, category pages, and listing cards you want to learn from. In the original project, I selected a law firm directory as a design reference, not as a source of branding or copy.

Study how the homepage, search box, location filters, listing cards, and detail pages work on desktop and mobile. Record the useful patterns, then create your own colors, typography, icons, images, and page copy.

Warning: Do not copy another site’s logo, text, photos, or protected artwork. Do not assume that visible business profiles or third-party images are free to republish. Use screenshots for general layout ideas and confirm your rights to each data source.

In the original workflow, I provided a screenshot to Sonnet 4 and used a tool called GFast Scraper to assemble a sample dataset. The scraper’s current availability, permissions, and features have not been independently confirmed. A scraper is not proof that the collected information can legally be republished.

  • Define a US law firm search area and the business details you need.
  • In this example, aim for a limited pilot dataset of up to 100 records; available results depend on the tool and source.
  • Collect only permitted fields, such as business name, contact details, location, practice area, and business hours. Use photos only with permission.

Save the permitted dataset as an XLSX file with one business per row. Keep a source URL, retrieval date, and stable source ID for each record so you can correct or update it later.

Remove duplicates and blank rows. Standardize names, city and state labels, phone numbers, and office websites. Check contact details against official firm sites where possible. Treat missing hours as unknown rather than inventing them, and leave image fields blank unless you have usage rights.

Spreadsheet of law firm names and location data prepared for import

How to Write a Claude Sonnet Prompt for a Directory Theme

Claude Sonnet works best with a clear specification of the site structure and the code you want. The original Sonnet 4 API model was retired on June 15, 2026, so select a supported model in your editor before starting. See Anthropic’s model retirement documentation.

Tell the assistant to create a classic WordPress theme with PHP templates and to keep listing data separate from the theme. WordPress recommends registering custom post types in a plugin, so changing themes does not remove the post type from the admin. See WordPress custom post type guidance.

Your prompt should include these specific variables:

  • Folder Name: Use a descriptive, hyphenated name like “law-firm-theme-sonnet-four”.
  • Site Title: Define the name of your directory.
  • Custom Post Type: Use law_firm as the internal post type key in a small companion plugin; use law-firms for the public URL slug if desired.
  • Custom Taxonomy: Register a hierarchical location taxonomy, with US states as parent terms and cities as child terms, or document another clear state/city approach.
  • Directory Category: Use a practice_area taxonomy if you need filters such as family law or estate planning. Do not assume a category label alone improves rankings.
  • Country: Specify the United States and choose consistent state, city, and address formats.

End the prompt by asking for an original, responsive visual system informed by the screenshots, not a pixel-for-pixel clone. Supply your own brand colors and ask the model to flag any files or design assets it cannot generate safely.

Example Claude Sonnet Prompt for a Law Firm Directory

Use this short specification as a starting point. Replace the project name and add your own branding details before running it.

Build an original, responsive classic WordPress theme for a US law firm directory.
Theme folder: law-firm-theme-sonnet-four
Post type: law_firm, registered in a companion plugin
Public listing slug: law-firms
Taxonomies: location (state > city), practice_area
ACF fields: address, phone, website, hours, source_url, verified_date
Pages: homepage, archive, single listing, location, search, 404
Design: use the attached screenshot for structure only, not logos or artwork
Code: safe escaping, accessible forms, responsive CSS, no hard-coded listings
Deliver: file tree, code, plugin setup, installation steps, test checklist
Flag assumptions and do not claim the code has been tested.

Pro Tip: Request front-page.php, archive-law_firm.php, single-law_firm.php, taxonomy-location.php, search.php, header.php, footer.php, and reusable listing cards, with safe fallbacks when a field is empty.

Request responsive CSS, keyboard-friendly navigation, escaped output, validated URLs, secure form handling, and correct WordPress template conventions. Ask for an explicit file list, setup steps, and a list of items that still need manual testing.

Directory theme prompt prepared for Claude Sonnet coding assistant

Generate and Review the WordPress Directory Theme

Set up a test WordPress site in Local WP and open the site’s theme directory in Visual Studio Code. A local site reduces the risk of breaking your live website. Some AI features still require an internet connection.

Create a folder such as law-firm-theme-sonnet-four under wp-content/themes/. Paste your instructions into the supported coding assistant and attach the reference screenshots. Review the files it drafts, then request corrections in small steps rather than assuming the first output is complete. Register the law_firm post type and taxonomies in a companion plugin, not only in the theme.

For a classic theme, check that style.css contains a valid theme header and that index.php exists. Review functions.php and each archive, single-listing, and taxonomy template. Confirm that field names match ACF exactly. Run PHP syntax checks and inspect the code for unsafe direct output, unsanitized input, and unexpected external requests.

Note: AI-generated PHP and JavaScript may contain errors or insecure patterns. Test on a local or staging site first, keep backups, and review any code that processes forms, uploads, search queries, or user data.

AI coding workflow drafting PHP files for a WordPress directory theme

Installing and Activating Your Generated Theme

If the generated folder is already inside your local site’s wp-content/themes/ directory, open Appearance > Themes and activate it. To install a ZIP on another WordPress site, use Appearance > Themes > Add New > Upload Theme, then activate it after checking the files.

Install ACF and create a field group assigned to the law_firm post type. Add fields such as address, phone, website, hours, and a source or verification date. If you use ACF Local JSON, create a writable acf-json folder inside the active theme. ACF can save field groups there; supplied local JSON files may show a Sync available option when their database versions are missing or older. See the ACF Local JSON guide.

After activation, save permalinks under Settings > Permalinks if new archive URLs return 404 errors. Check the homepage, the listings archive, a state or city page, and a single listing. Confirm that the post type and taxonomy are registered and that ACF values appear only in their intended locations.

WordPress directory theme preview with AI-generated page layout

Import XLSX Business Listings into WordPress

Choose an importer that supports Excel files, your custom post type, hierarchical taxonomies, featured images, and ACF fields. These options are not universal across plugins or license tiers. For example, WP All Import documents Excel and ACF mapping through its integration.

Example Spreadsheet-to-WordPress Field Map

XLSX columnWordPress destinationCheck
business_namePost titleUse the firm’s current public name
state / citylocation termsCorrect parent state for each city
phone / websiteACF contact fieldsValidate phone and website format
source_idImporter unique identifierStable across future imports
image_urlFeatured imageOnly import authorized images
  • Upload your prepared XLSX spreadsheet.
  • Select the registered law_firm post type.
  • Map state and city columns to your chosen location taxonomy or separate location structure.
  • If using one hierarchical location taxonomy, create cities as child terms under their correct state parent terms.
  • Map ACF fields, featured images you have permission to use, and a unique source ID for later updates.

Preview the field mappings, including how the plugin treats empty values. Set an appropriate unique record identifier so a later import updates an existing firm instead of creating a second copy. Make a database backup before running the import.

Import 5 to 10 rows first. Check names, addresses, phone numbers, hours, images, cities, and state pages on both the edit screen and the public site. Correct mapping errors before importing the full spreadsheet; verify record counts again when it finishes.

Pro Tip: Save the untouched source spreadsheet, a cleaned working copy, and an import log. A consistent unique ID makes future corrections and repeat imports safer.

Importer screen showing how spreadsheet columns become WordPress listings

Reviewing Design and Functionality

Review the site after your small test import and again after the full import. Make sure the header, footer, and navigation support your own branding and work with real listing data.

Open sample listings and compare their contact details with your approved sources. Confirm that each state page shows the right city links and that filters return matching firms. Do not display unverified hours as confirmed facts.

Test search with a firm name, a city, and a practice area. Check the empty-results state, keyboard navigation, readable contrast, touch targets, and layout on mobile screens. Search and filters must work, not simply look interactive.

Visitors should be able to find the right firm, see where the information came from, and contact that firm without confusion.

Custom law firm directory homepage with location-based browsing

Validating Data Structure

Open several state and city archives, including cities that share a name across states. Each archive should show only firms assigned to the correct terms.

Each single listing should show the firm name, address, contact methods, practice areas if verified, and a link to its official website. Add nearby listings only when the location match is meaningful.

Use one style for state labels and one location path for each city. For example, do not create separate California terms called “CA” and “California”. Under a parent/child system, “Springfield, Illinois” and “Springfield, Missouri” must be distinct child terms.

Check duplicate business records by source ID and address rather than title alone. Verify image permissions, make missing data visible as missing, and provide a way for firms to request corrections. If many records share the same error, repair the source data or field mapping before importing more.

Sample law firm listing showing contact information, hours and related locations

Optimizing Your Directory for Launch

Refine your site before going live to ensure a professional experience for your users.

  • Use consistent state names and city-parent relationships; update import mappings if labels differ.
  • Replace theme demo logos and hero graphics with original or properly licensed assets.
  • Fix CSS layout gaps and check focus states, image sizing, and small-screen spacing.
  • Confirm that ACF and the listing post type plugin are active; keep the importer only if needed for updates.

Ask a qualified WordPress developer to review complex PHP, database, or security problems. AI-generated code should not be published solely because it renders without visible errors.

Before launch, check page speed, broken links, duplicate listings, empty archives, canonical URLs, XML sitemap inclusion, and accidental noindex settings. Publish an editorial policy, privacy notice, contact page, and a correction process. Clearly explain that a directory listing is informational and does not itself endorse a lawyer or create an attorney-client relationship.

Make Location Pages Useful for Search Visitors

Give each valuable state and city page a clear heading, short introduction, and relevant listings. Avoid publishing hundreds of near-empty location pages with only a city name changed. Link related locations naturally and keep filters and archive URLs consistent.

Use a sitemap and indexing settings that match the pages you actually want search engines to discover. Review performance and broken links after launch, then refresh business details when you have verified updates.

Note: Lawyer advertising and referral rules can vary by jurisdiction. Verify professional claims and directory descriptions, avoid unsupported rankings or endorsements, and review applicable data-source terms before publishing.

Frequently Asked Questions

What is Sonnet 4?

Claude Sonnet 4 was an Anthropic AI model used for code generation and screenshot-guided design. Its original API model was retired on June 15, 2026. Use an available supported Sonnet model in your coding tool to follow this workflow.

Can Sonnet 4 create exact website clones?

An AI assistant can draft a site with similar navigation or card patterns, but you should not copy someone else’s protected assets or brand identity. A functional, original design also needs manual review and testing.

Do I need to know how to code?

You can start with basic WordPress skills, but you still need to review generated code, activate plugins, configure fields and taxonomies, test imports, and fix any errors. A developer can help with advanced security and PHP issues.

Is this method limited to law firm directories?

No. The same WordPress structure can support restaurant, contractor, or other directories. Change the listing fields and taxonomy design, and make sure your source data can be used for that purpose.

Why should I use an XLSX importer instead of adding listings manually?

An XLSX-compatible importer can create or update many listings at once. Depending on the plugin and add-ons, it may also map custom fields, taxonomies, and images. Always test a small batch and use a stable ID to avoid duplicates.

What should I check before publishing the directory?

Check listing accuracy and permissions, archive pages, search filters, contact links, mobile display, accessibility, duplicate records, plugins, backups, and your site’s privacy and correction policies.

Conclusion

A Claude coding assistant, custom WordPress theme, ACF, and a careful spreadsheet import can reduce repetitive setup work. You still need to verify every important code path, ensure your dataset is publishable, and check that visitors can find accurate listings.

Start with one state and a small, permission-cleared dataset. Build and test that pilot before expanding the directory to more cities or states.

Last Updated on October 31, 2026 by Logan Carter

Written by

Senior Web Developer

Ethan Walker is a skilled web developer specializing in responsive design and front-end development. At 29, he brings innovative ideas and a user-first approach to every project, helping Templytic clients achieve sleek, modern websites that perform seamlessly across all devices.

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *

Search the site

Popular topics