How to use advanced custom fields to build a dynamic blog layout
Advanced Custom Fields (ACF) gives WordPress editors control over how individual posts appear without changing the theme every time. Instead of one fixed article template, a site can include feature stories, practical guides, interviews and case studies, each with its own structure while sharing the same design system.
Editors select a layout in the WordPress sidebar, complete only the relevant fields and publish. Developers define those fields and the PHP templates that render them. This split keeps routine publishing simple while giving a developer control over performance, accessibility and long-term maintenance.
For an Australian audience, the content model can reflect local expectations: Australian English spellings such as “organisation”, prices in AUD and clear treatment of the 10% GST. Creators publishing for readers in Sydney, Melbourne and regional centres can give each guide its own service area and local context.
You will need WordPress, the Advanced Custom Fields plugin and access to a staging site. A child theme or custom block theme is needed for template work; Repeater and Relationship fields normally require ACF PRO. The plugin itself has Australian roots, having been created by Brisbane-based developer John Elliott.
Design the content model before the visuals
Start by identifying the distinct formats your publication needs. A feature story might require a large image and introductory summary, while a guide may need key points, a service area and related articles. Interviews can use a profile panel, and case studies can display verified results. Define these editorial differences before creating visual sections in the theme.
Business content needs the same discipline. An article that helps someone assess a retail system should acknowledge the POS business drawbacks rather than present technology as a guaranteed fix. Questions about setup costs, ongoing support and operational risk can then become fields within the publishing model.
Keep the field structure independent of colours, spacing and typography. A field named service_area should describe the content, regardless of whether it appears in a sidebar, header or mobile card. This makes the model easier to redesign and suitable for a custom post type if you later launch a separate resource library.
Create a reusable field group
Install ACF, create a field group named “Post presentation” and restrict it to the post type you use for articles. Start with a select field called layout_style, offering article, feature, guide, interview and case study. Add an image field for the hero, a textarea for the summary, and a Repeater for key points or statistics.
Add only the fields that support editorial decisions. Useful choices include author_profile, related_articles, service_area, starting_price, seo_title, seo_description and a boolean field such as show_key_points. Return image fields as image arrays so the theme can request suitable sizes instead of loading one oversized file on every screen.
Use conditional logic within the WordPress editor. When an editor chooses the interview layout, the interview fields can appear while irrelevant fields remain hidden. Set required fields carefully and provide clear labels. Conditional fields should change what editors see without hiding essential information from visitors through CSS alone.
Render each layout in the theme
Copy the appropriate template into a child theme or add a custom block template. Use the main WordPress loop to retrieve the selected layout and its associated values. ACF stores the values as post meta, but the theme should still validate and escape each output according to its type.
A simplified template could begin like this:
<?php
$layout = get_field('layout_style', get_the_ID());
$hero = get_field('hero_image', get_the_ID());
?>
<article class="story story--<?php echo esc_attr($layout); ?>">
<?php if ($hero) : ?>
<?php echo wp_get_attachment_image($hero['ID'], 'large'); ?>
<?php endif; ?>
</article>
Build the remaining sections with conditional blocks for the hero, summary, main content, key points, author panel and related resources. Keep the standard post content available through the_content(), allowing editors to use familiar WordPress editing tools while ACF controls the surrounding structure.
Escape text with functions such as esc_html() and esc_attr(), validate URLs before using esc_url(), and restrict access to sensitive fields. ACF does not replace WordPress security checks. Template code should also support responsive layouts, keyboard navigation and meaningful image alternative text.
Build reusable bundles and display rules
The first field bundle can support recurring editorial formats:
- Featured case study: Client, sector, challenge, result and one verified metric.
- Local service guide: Service area, starting price, contact method and AUD/GST note.
- Expert interview: Profile, credentials, related topics and a selected pull quote.
- Product article: Product identifier, current price, availability and purchase link.
A second bundle can determine how those values appear:
- Feature layouts: Full-width hero, compact summary and prominent image.
- Guides: Contents panel, key points and links to related explanations.
- Interviews: Profile beside the opening and topic tags at the end.
- Case studies: Result metric after the challenge and relevant services below.
Curate related content with taxonomy terms and an ACF Relationship field. A normal WP_Query can collect articles sharing a topic, while a Relationship field can provide editor control over featured recommendations. Avoid running a new query inside every template block; prepare the data once and reuse it to reduce database work and inconsistent results.
Optimise search, speed, and Australian relevance
Treat performance as part of the field architecture. Request responsive image sizes, set width and height attributes, and let WordPress handle lazy loading where appropriate. Cache expensive queries and avoid repeated calls to get_field() for the same post. Test each layout with caching enabled, since page-builder scripts and oversized media can create different loading times.
Connect the SEO fields to your search optimisation plugin. The seo_title and seo_description values can feed metadata hooks, while featured images can support social previews. Keep one canonical URL per post and generate structured data only when the information is present. ACF supplies the content; the SEO plugin and theme still control how that content is interpreted.
Local relevance should extend beyond spelling. Australian readers may recognise informal expressions such as “arvo” or “have a go”, although technical instructions should remain precise. Claims about responsible sourcing also need reliable references. For businesses publishing claims about ethical operations, CSR supply chain guidance can provide supporting material, with the source URL stored in a repeatable citation field for proper attribution.
Launch, test, and scale the workflow
Build the system on a staging site before changing live templates. Test every layout at desktop, tablet and mobile widths. Ask an editor to create each article type without help, then check that required fields, conditional sections, links and image fallbacks behave correctly. Export a database backup before transferring the field definitions or templates to production.
Existing posts can use a default layout while you add the new fields gradually. Record the preferred template for high-performing articles, but avoid designing permanent rules around a small sample. Review search performance, page speed and reader behaviour after launch, then refine field choices based on actual publishing needs.
Advanced Custom Fields turns WordPress templates into a flexible editorial system without sacrificing consistency. Install the plugin, build the field group on staging and publish your first layout-controlled article today.