Posted By

itsmrchris on 10/24/12


Tagged

wordpress ACF


Versions (?)

Wordpress Advanced Custom Field (ACF) - Display field content


 / Published in: PHP
 

In this example it checks to see if the page it is on has an ACF named page_title, if so - display it as an H1, and if not, display the WP default page title as the H1

  1. <?php $values = get_field('page_title'); ?>
  2. <?php if ($values) { ?>
  3. <h1><?php the_field('page_title'); ?></h1>
  4. <?php } else { ?>
  5. <h1><?php the_title(); ?></h1>
  6. <?php } ?>

Report this snippet  

You need to login to post a comment.