1. don’t understand
2. understand
3. yes
4. in attachment
5. yes
6. understand
Its complicated, I have a second thought, its easily define title of a post by using 'post_title' => $_POST["fields"]['field_52e6af7f6f4b8']
As like this, can I define field for custom taxonomy “rent”, 'rent' => $_POST["fields"]['field_52e6afd36f4bc'] or for post Tags 'post_tag' => $_POST["fields"]['field_52ee3572071cd']
where field_52e6afd36f4bc or field_52ee3572071cd is custom text field.
If second thought is possible, first is dismissed.
Thanks for holiday replay.

Hi @jwight1234
The easiest option is to use the repeater field to ‘repeat’ your custom field type. This involves no code updates to work.
If you want just 1 field on the page, which can save multiple values, then you need to add in multiple input elements.
Currently, you should have an input that has a name attribute of $field[‘name’].
<input name="<?php echo $field['name'] ?>" value="something" />
To save multiple values as an array, you can change this to:
<input name="<?php echo $field['name'] ?>[]" value="val 1" />
<input name="<?php echo $field['name'] ?>[]" value="val 2" />
Adding in the extra [] to the name, allows you to save values as an array!
Thanks
E

Why not:
<?php if(get_field('worksheet_link')): ?>
<a href="<?php the_field('worksheet_link'); ?>">Go to Worksheet</a>
<?php endif; ?>
Thanks
E

I have a few questions regarindg your code:
1. The code should be wrapped in a filter for acf/pre_save_post
2. This is a filter for the acf_form function
3. Are you using the acf_form function?
4. If so, what $options are you using in the acf_form function?
5. Have you debugged your code?
6. There is an issue with your code: $_POST['field_52e6afd36f4bc'] should be $_POST['fields']['field_52e6afd36f4bc']
Thanks
E

Hi @qstudio
It is possible that you have a large amount of posts in the DB, and because the current post_object field is not efficient, it is failing to query all the pages form the DB.
This has been fixed in ACF5 (soon to be released), but it may also be another issue entirely.
You said that the issue only happens on the live site, not local? This points to the issue being a DB load problem.
If you want, I can log into your site, and if you give me access to edit plugins, I can do some debugging in the post_object field to find the issue?
Thanks
E

Hi @lowercase
If you are using the post_object to select an ‘artist’ for each ‘release’, then you can simply query the posts to find all releases from 1 artist by following this tutorial:
http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/
Thanks
E

Hi @SQD
Thanks for the question. You are quite right, the data is still intact in your DB and it is possible to change the field type from repeater to flexible content.
Both field types save the sub field data in the same way, the only difference is the way they save their own reference data. By this, I mean how many rows are saved.
The repeater field will simply save a number like so: 3
This means that there are 3 rows of data available, and the repeater field will load them in.
The flexible content field does not save just a number, instead it save’s an array of ‘layout’ names like so: array('content', 'images', 'download')
This means that there are 3 rows of data available, and the flexible content can load the appropriate ‘layout’ and the data.
So, all you need to do is edit your DB (wp_postmeta table) where the meta_key is your repeater field name. The value will be a number, and you will need to change it to a SERIALIZED array containing the correct number of layout names.
Hope that helps.
Thanks
E
Seems it could well be ACF:-
event.returnValue is deprecated. Please use the standard event.preventDefault() instead. load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jq…:4
body.scrollLeft is deprecated in strict mode. Please use ‘documentElement.scrollLeft’ if in strict mode and ‘body.scrollLeft’ only if in quirks mode. load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jq…:304
body.scrollTop is deprecated in strict mode. Please use ‘documentElement.scrollTop’ if in strict mode and ‘body.scrollTop’ only if in quirks mode. load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jq…:304
Uncaught ReferenceError: acf is not defined
The last error in bold is flagged red.
Thanks
Glenn
Plus 1 on this request. It wasn’t clear to me from the docs that the fields added via PHP wouldn’t show. I took it to mean that would only be the case if I specifically disabled the UI. Would be really helpful to have the option to show them.
Issue: Field Group location rule is being stored to database but is NOT being shown as selected when viewing the Field Group.
Steps to reproduce:
1) Go to Custom Fields menu
2) Select Add New Field Group from top of page. Title: Gallery Details
3) Create fields (XML at bottom of this post)
4) Select Location Rule = Show this field group if Post Type is equal to gallery.
5) Publish Field Group.
6) Go to Gallery Post Type edit screen and the ACF form is there.
7) Go back to Field Group and Edit Gallery Details.
8) The Location Rule defaults back to Post Type = post.
9) If I update anything in the field group and do not also re-change the location rule back to Post Type = gallery, the ACF form will be moved from gallery CPT to post.
I *believe* the issue is related to my initial choice to use _ in my field names (gallery_photo, gallery_event, gallery_photographer) causing the location group to return to default.
This is what I did. Thanks.
//Upload la photo dans le dossier
require_once(ABSPATH.’wp-admin/includes/file.php’);
$uploadedfile = $_FILES[‘photo’];
$movefile = wp_handle_upload($uploadedfile, array(‘test_form’ => false));
//On sauvegarde la photo dans le média library
if ($movefile) {
$wp_upload_dir = wp_upload_dir();
$attachment = array(
‘guid’ => $wp_upload_dir[‘url’].’/’.basename($movefile[‘file’]),
‘post_mime_type’ => $movefile[‘type’],
‘post_title’ => preg_replace(‘/\.[^.]+$/’, ”, basename($movefile[‘file’])),
‘post_content’ => ”,
‘post_status’ => ‘inherit’
);
$attach_id = wp_insert_attachment($attachment, $movefile[‘file’]);
update_field(‘photo’, $attach_id, ‘user_’.$current_user->ID);
}
Thanks for the response @elliot. Is it something that could be requested as a paid add-on or to the core?
My apologies for the confusion.
My code prints out the loop that I want, however, it is not sorted by the date field that I specified. I just need my loo[p to list items in chronological order based on the date field that is specified in the query.
'meta_key' => 'date_received',
'orderby' => 'meta_value_num',
Hi, thank you for this,
It works much as the second and third options do already – that is – as long as it’s not wrapped in a hyperlink it shows only on those introductions that have a worksheet. Once I wrap the if statement with href:
<a href="<?php if(get_field('worksheet_link')){the_field('worksheet_link');} ?>">Go to Worksheet</a>
…it appears on all the introductions again.
Any other ideas?
Sorry elliot still your work with a novice here… still working on my PHP knowledge. Couldn’t get the print_r function to work for me either 🙁
Thanks again for your help, the plugins you have developed are great and it’s change the way I work with and understand wordpress. Cheers
Here is my code for the page
<?php
/*
Template Name: Project Template
*/
?>
<?php get_template_part('templates/content', 'page'); ?>-->
<?php get_template_part('templates/page', 'header'); ?>
<div class="wrap container" role="document">
<div class="content row">
<?php
$args = array(
'post_type' => 'projects',
'order' => 'ASC'
);
$the_apppage = new WP_Query( $args );
?>
<div class="row">
<?php if ( have_posts() ) : while ( $the_apppage->have_posts() ) : $the_apppage->the_post(); ?>
<div class="col-md-4">
<i class="fa fa-arrow-circle-o-right"></i>
<article class="project-item web-design image">
<a class="imageover" href="<?php the_permalink(); ?>">
<!-- Gallery Test Code Here -->
<?php $images = get_field('gallery'); ?>
<h1><img src="<?php echo $images[0]["url"]["thumbnail"]; ?>" ></h1>
<!-- Gallery Test Code Here end -->
<img class="img-responsive project-thumb" src="<?php the_field('gallery_feature_image');?>" alt="<?php the_title(); ?>"><!--Project thumb -->
<div class="details">
<h3 class="project-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3><!--Project Title -->
<small><?php the_excerpt(); ?></small><!--Project Categories -->
</div>
</a>
</article>
</div>
<?php endwhile; else: ?>
<p>There are no posts or pages here</p>
<?php endif; ?>
</div>
</div>
I add bellow code to the theme function.php
$post = array(
'post_status' => 'publish',
'post_title' => $_POST["fields"]['field_52e6af7f6f4b8'] ,
'post_content' => $_POST["fields"]['field_52e6af906f4b9'],
'post_type' => 'post'
);
// insert the post
$post_id = wp_insert_post( $post );
update_field('field_52e6afd36f4bc', $_POST['field_52e6afd36f4bc'], $post_id);
// update $_POST['return']
$_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );
// return the new ID
return $post_id;
}
where “field_52e6afd36f4bc” is the field key of custom taxonomy “rent”. I don’t understand what is update_field()’s $value for frontend new post, where user insert a value, not like the example- $value=”some string”.
And where I put update_field(), into function.php or templete.php.
Right. I’m confused. Of cause this is the wrong place for that question, sorry.
Hi @elliot!
It’s exactly what @Bienfeo and @unkulunkulu have already described. But let me try to be a bit more precise (and correct) on this issue:
In case a file with the name “wp-content/object-cache.php” exists (which is provided by the quite common “Memcached” plugin “http://wordpress.org/extend/plugins/memcached/”, version 2.0.2), then updating of ACF values will fail (not creation though!).
I was wondering if you could emit a simple pointer to this issue at the top of the ACF management section in the backend (“wp-admin/edit.php?post_type=acf”, which integrates the “create_options” method from each field type). That place would be where you get stuck in case you have an “wp-content/object-cache.php” installed and you could simply tell people:
If you are unable to update ACF values, please try removing or renaming the file “wp-content/object-cache.php” from your installation.
Cheers
Günther

Hi @Spathon,
Please tell me if this:
http://support.advancedcustomfields.com/forums/topic/slow-page-load-w-page-links/
answers your question. If not, just reply back here.
Cheers

Hi @alexgold05
You are missing the $post_id parameter from the update_field function:
http://www.advancedcustomfields.com/resources/functions/update_field/
Please change your code to:
$field_name = "dashboard_page";
$value = "new page name";
update_field( $field_name, $value, 'option' );

Hi @sidney.gpa
It is possible to use ACF to render your select field. Then, your front end select field will behave the same as your back end select field.
You can do so like this:
$field_key_xyz = "field_52e81ce100934";
$field = get_field_object($field_key_xyz);
create_field( $field );
Thanks
E

Hi @andrefelipe
The point of the field’s key is to be a unique identifier. The field name may be the same, but never the field key.
There is no solution or fix to this other than modifying your fields to use different keys.
You can use the field_name in your template files (get_field($field_name)).
Thanks
E

Hi @Grégoire Noyelle,
Thanks for the feature request 🙂
Have a great day

Hi @debosset
Am I correct in assuming your question is this:
i don’t know how to get the field that is number with the select field
Can you please better describe this issue?
Perhaps you could read over the has_sub_field or have_rows or repeater field documentation articles?
Your code is far to complex for me to offer any free ACF support, perhaps you can be very specific as to what you need help with, as I can’t provide the time to debug your entire code to understand what does and doesn’t work.
Thanks
E

Hi @Athen
I don’t understand your question. ACF does not create post types, it creates custom fields.
Genesis is a theme, ACF saves data to a post.
You can edit your theme to show ACF data.
Thanks
E
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.