Each field will have a type, and name, and a label. To display fields automatically you need to add the code to your theme that references these fields. The code may be different from field type to field type, but you would reference them using their field name. The documentation on this website has many code examples of how to do this. You can also use shortcodes to display data, but you would have to add them into each post individually.
I recommend you read through this article regarding displaying the data associated with your fields: http://www.advancedcustomfields.com/resources/getting-started/displaying-custom-field-values-in-your-theme/
From there, have a look at this page (http://www.advancedcustomfields.com/resources/) which will help you learn how take full of advantage of this plugin. If you still need help, you’re welcome to use this forum to ask questions, of course!
Hi @lowercase,
Here’s a recent topic that might help!
http://support.advancedcustomfields.com/forums/topic/radio-button-values/
Can you describe what you’re using the sub fields to build, and also give an example of what your ID and label would contain?
Have you added the code to your theme files? See the below link.
http://www.advancedcustomfields.com/resources/field-types/text/
Allright, how long have you been working with WordPress? Are you very familiar with the admin panel?
I understand how you feel. Maybe I can explain it. On the WordPress platform, pages are displayed in groups of data, and they are referred to as “posts.” WP comes out of the box with two “post types” ; “pages” and the standard “post.”
The WordPress API allows you to attach “custom fields”, or blocks of data to any post. However, the API is fairly cumbersome for the average user to find useful, so there have been several frameworks built to make the process more user friendly. ACF is one of them.
ACF is maintained for free, but offers expanded functionality in the form of add-ons such as repeater and flexible content. Offering these add-ons for a fee helps support forums like this one, which offers free support by experts, and helps people like you and me connect the dots where needed, so they can make full use of the software and get their money’s worth.
Hi @elliot,
Ah thank you! Maybe I will end up using the flexible content field in the future. Seems to be a more streamlined way of handling it for the client. For right now though, this has definitely helped me find my way out of the rabbit hole I was in.
In any case, thank you very much, I had been staring at this late into the night last night, maybe for a bit too long. 🙂
Hi there @alpinepvp,
You are absolutely correct, you could most definitely use ACF to build a menu. What you’ll probably want is the repeater add-on.
You could build a Field Group called something like:
“Menu Section” (For instance, a section could be called “Pancakes”)
Then within that field group, add a text field for the section title, then create a new repeater field with a text field for the menu item, a text area for the item description, then another field type of your choosing for the price.
You will of course have to be a little handy with WordPress templating, PHP, and of course, your good ol’ pal Google.
Hopefully that points you in the right direction!
You are most welcome @sbrenner7!
In this situation, you could try something like this:
http://stackoverflow.com/questions/12444945/cut-the-content-after-10-words
Hi,
This is how I did it:
if (get_field('field_name') == 'Field Value') {
// code to run if the above is true
} else if (get_field('other_field_name') == 'Other Field Value') {
// more code
}
If you still can’t get it, let me know here.
Hi,
Yes, conditional logic is what you want.
You would do something like:
if (get_sub_field(‘menu_type’) == ‘Featured’) {
// add your fields here
}
The function will vary depending on what you’re checking against (radio or checkbox), or what level your field sits at in your field group.
Check the docs for how reference either of those fields. That should get you started.
There’s some similiar types of issues on the forum here:
http://support.advancedcustomfields.com/forums/search/?bbp_search=max_input_vars+%3D+3000
What solved my issue was dropping the following into the top of my WP site’s .htaccess file:
php_value max_input_vars 7000
Hi there, what you’re trying to do could be achieved with a built-in PHP function.
Check out this article:
http://stackoverflow.com/questions/173868/how-to-extract-a-file-extension-in-php
You would declare a variable to use as the file extension. Something like:
$ext = pathinfo($url, PATHINFO_EXTENSION);
Reference: http://php.net/manual/en/function.pathinfo.php
Hi there, I’ve run into similar issues. This article helped me out a lot:
http://stackoverflow.com/questions/936242/php-how-do-you-determine-every-nth-iteration-of-a-loop
You’ll need to start a counter just above your while loop:
$counter = 0;
You should be able to drop an if statement into your while loop:
if ($counter % 4 == 0) {
// code here
}
Then just before your closing endwhile; you’ll need to advance the counter:
$counter ++;
The if statement will evaluate to true every 4 iterations of the loop.
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.