WordPress:Advanced CustomFields
@PeacockCarter
A typical page or post
Available fieldsTitleFeatured imageContent
But what if you want more?
Our options✖ Add HTML to your content? Custom post types? Advanced Custom Fields (ACF)
ACF examples:Custom field field
@PeacockCarter
ACF examples:Repeater field
@PeacockCarter
Advanced CustomFields plugin
@PeacockCarter
What does ACF do?Gives you the ability to add custom fields beyond WordPress’ defaults
ACF – free versionCustom fields
ACF Pro $25AUDsingle site license
$100AUDdeveloper license – unlimited installs, lifetime updates
ACF Pro featuresRepeater fieldGallery fieldFlexible Content FieldClone field
ACF demo:Creating a Field Group
@PeacockCarter
Using ACF in templates
@PeacockCarter
Using a field in a template<?php if( get_field('sub_heading') ): ?>
<h2>
<?php the_field('sub_heading'); ?>
</h2>
<?php endif; ?>
Using the repeater field in a template<?php
if( have_rows('repeater_field_name') ):
while ( have_rows('repeater_field_name') ) : the_row();
the_sub_field('sub_field_name');
endwhile;
else :
// no rows found
endif;
?>
ACF vsCustom Post Types
@PeacockCarter
Custom Post TypesBest when content needs to beused in multiple areas acrosswebsite
Custom Post TypesCreates a post in WordPress = an indexable instance of content.
ACF is useful when…1. to edit specific or blocks ofcontent in one page template
ACF is useful when… 2. The layout stays the same, but the content changes
Learned something?@PeacockCarter