Home Articles Uncategorized Using Advanced Custom Fields (plugin) for SEO

Using Advanced Custom Fields (plugin) for SEO

If you’re already using the Advanced Custom Fields for clients and you want to incorporate SEO fields for clients, I add this code to the <head> section (this is conditional):

<!-- For Titles -->

<?php if(get_field('seo_title')): ?>
<title><?php the_field ('seo_title');?></title>
<?php else: ?>
<title><?php if(is_front_page()): ?><?php bloginfo('name'); ?><?php else: ?>
<?php wp_title(''); ?><?php endif; ?></title> 
<?php endif; ?> 

<!-- For Descriptions -->

<?php if(get_field('seo_description')): ?>
<meta name="description" content="<?php the_field('seo_description');?>" />
<?php endif; ?>