What kind of fields are they? Text fields?
Where are the fields located in the dashboard?
<?php
$title = get_field('title');
$field1 = get_field('field1');
$field2 = get_field('field2');
?>
<h1 class="post-title"><?php echo $title $field1 $field2; ?></h1>
I solved this for anyone else that has the same problem. It was basically my ignorance and oversight:
<section id="awards">
<?php if( have_rows('award_images', 'options', true) ): ?>
<div class="container">
<div class="row">
<h2 class="awards text-center"><span>Awards</span></h2>
<div class="awards-wrap col-md-12">
<ul class="awards">
<?php
while( have_rows('award_images', 'options', true) ): the_row();
// vars
$award_image = get_sub_field('award_image');
$award_image_link = get_sub_field('award_image_link');
?>
<li class="award">
<?php if( $award_image_link ): ?>
<a href="<?php echo $award_image_link; ?>">
<?php endif; ?>
<img src="<?php echo $award_image['url']; ?>" alt="<?php echo $award_image['alt'] ?>" />
<?php if( $award_image_link ): ?>
</a>
<?php endif; ?>
</li>
<?php endwhile; ?>
</ul>
</div>
</div>
</div>
<?php endif; ?>
</section>
I just moved the if (have_rows() ) line inside the section element. 🙂
Specifically, the award_image field, as the links are already hidden if they’re empty, my thought is that it’s because the var isn’t declared above the beginning of the output.
If you’re not using the “pro” version you might have to alter the path to the plugin. 🙂
I used this in my functions.php file:
add_filter('site_transient_update_plugins', 'my_remove_update_nag');
function my_remove_update_nag($value) {
unset($value->response[ 'advanced-custom-fields-pro/acf.php' ]);
return $value;
}
the “my” can be whatever you want. 🙂
style="background-image:url('<?php echo $hero['url']; ?>');
?
http://www.advancedcustomfields.com/resources/including-acf-in-a-plugin-theme/ Might answer your questions.
I’d say that means that if you use it in a theme, that is the latest version they can get unless they buy their own license, then they can get updates.
I’m not a lawyer. So I might be misunderstanding.
I second that this is the most useful WP plugin I’ve ever seen. It fits my needs perfectly for the most part, but I haven’t even figured out half of what I can accomplish with it yet. The parts I have used are great though. 🙂
Thanks for creating it. 😀
Not a problem. I ran into this a couple times and that turned out to be the culprit. 🙂
Are you sure you have the license key entered into the site that is not updating?
You probably created one when you joined. If you have forgotten it, click the “forgot password” link next to a login form and they will probably send you a link to reset it. 🙂
If title is a sub field this should work. If it’s not a sub field, change it to get_field(‘title’)
<?php
if( have_rows('repeater_field_name') ):
$title = get_sub_field('title');
$repeater_subfield_name = get_sub_field('repeater_subfield_name');
if( !empty($repeater_subfield_name) ):
?>
<h2><?php echo $title ?></h2> // need to hide this if subfield is empty
<?php endif; ?>
<ul>
<?php while ( have_rows('repeater_field_name') ) : the_row(); ?>
<li><?php echo $repeater_subfield_name ?></li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
Hope it works. 🙂
Actually, what is
<?php _e('Title');?>
?
I, for some odd reason just assumed it was part of the same repeater field. Is it? If, not, where is that “Title” coming from?
Hmmm, not the results I was expecting. A white screen maybe, but not that. 😛
Let me* setup a test locally, and I will figure it out. 🙂
No guarantees, I haven’t actually tested it. LOL 😉
<?php
if( have_rows('repeater_field_name') ):
$repeater_subfield_name = get_sub_field('repeater_subfield_name');
if( !empty($repeater_subfield_name) ):
?>
<h2><?php _e('Title');?></h2> //need to hide this if subfield is empty
<?php endif; ?>
<ul>
<?php while ( have_rows('repeater_field_name') ) : the_row(); ?>
<li><?php echo $repeater_subfield_name ?></li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
What is you change this
[acf field="featured_category_image"
to this
[acf field="featured_category_image['url']"
? 🙂
I think this will do what you are asking:
https://www.dropbox.com/s/nanezduxhojqkvh/Screenshot%202014-09-20%2003.19.40.png?dl=0
I found this here and am not sure how to work it into the code you posted above, but it looks to be a good way to get it to link to the image itself in the fancybox/lightbox.
<?php
$images = get_field('gallery');
if( $images ):
?>
<ul>
<?php foreach( $images as $image ): ?>
<li>
<a class="fancybox" href="<?php echo $image['url']; ?>">
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
</a>
<p><?php echo $image['caption']; ?></p>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
PS: Edit the above HTML as needed. 🙂
It has been a few since I upgraded but I remember that is was pretty easy. I just re-read the steps and it sounds pretty straightforward. 🙂
http://www.advancedcustomfields.com/resources/upgrading-v4-v5/
1. Backup your database (.sql)
2. If you are using any of the former V4 add-ons than make sure you have access ACF Pro
3. If you developed any “custom field types” then you need to upgrade them: http://www.advancedcustomfields.com/resources/tutorials/creating-a-new-field-type/
4. Add the ACF PRO plugin to your website (drag the advanced-custom-fields-pro folder to the /wp-content/plugins/) folder
5. Activate ACF PRO
6. Deactivate ACF 4 and any premium ACF 4 Add-ons
Then: http://www.advancedcustomfields.com/resources/upgrading-v4-v5/#after-you%20update
What part are you stuck on?
As far as the importing V4 backups into V5, can’t say for sure. Though you could import them into ACF 4 then upgrade to ACF5.
Via: http://www.advancedcustomfields.com/resources/code-examples/#getting-vales%20from%20another%20page
<?php
$other_page = 12;
?>
<p><?php the_field('field_name', $other_page); ?></p>
This is kinda off the top of my head. So there may be a better solution, as this is untested and might not even work. LOL 😛
The first thing you need is to ensure that the plugin is included and activated upon install…
So I would add the plugin to the theme via functions.php:
// set the path to the includes folder
define('THEME_INCLUDES', TEMPLATEPATH . '/inc/');
// load the ACF plugin
require_once (THEME_INCLUDES . 'advanced-custom-fields-pro/acf.php');
// hide the custom fields menu from the dashboard
define( 'ACF_LITE', true );
then include ACF within your theme structure:
your-theme/
-inc/
–advanced-custom-fields-pro/
—acf.php
-functions.php
-header.php
-style.css
…
and so on
Then in your dev theme, after you’ve created all the custom fields goto Custom Fields > Import/Export choose all the fields you want to export, then click “generate export code” copy that code and paste it into your themes functions.php file.
This assumes you just want to add the existing fields and not any content you have added to them.
You will also probably want to make heavy use of:
<?php
if ( !empty('field') ) {
// do this
} else {
// do that
}
?>
Hope this helps in some way. 🙂
You should be able to download it at your account page: http://www.advancedcustomfields.com/my-account/
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.