is it possible to create a post from an ACF block, while in the wordpress dashboard, not the frontend?
I have built a block using ACF, and I use it insert Video Cassette cards on a post. These cards come from a custom post type named ‘cassette_card’, and they’re very basic, having only a title, post content and featured image.
Let’s say I’m inserting these blocks on a post and I can’t find the one I’m looking for, because it doesn’t exist. Is there I way I can create one ‘cassette_card’ post record from within the block, so I don’t have to save, quit the editor, go add the record I want to the custom post type, and then come back?
Hi,
I’ve been looking through here an trying to find if this is possible but haven’t found any topics outlining this, I have this field setup with numerous entries(~200-300 rows), but they are not necessarily in the order I want on the back-end. I’d like to be able to use the column headings like in a excel table be able to sort that column via ascending/descending. I’m aware this can be done on the front-end, but with this many rows, to be able to find items either missing or needing to be added, if its not sort-able, it isn’t very efficient to try and find things.
Is there something that I could use to give this functionality or would this be a functionality feature request?
Thanks for any guidance.
I have built many sites using ACF Flexible Content field and created pre built components – image slider, faqs block, triple horizontal images, quote etc etc – basically giving the user the option of building a much richer page than possible with just a single wysiwyg field while maintaining some sort of content control. My issue has always been you have to either output the core wysiwyg content before your group of flexible content elements or after or alternatively you disable the default editor and build flexible content elements for paragraph of text, paragraph of text with title etc etc. My question is, with the release of gutenberg and the ability to create custom blocks within it, has this become the standard for creating multiple element content or does ACF flexible content still have many advantages over it?
Hello there,
I am building out a site and have ACF Pro. I am working on a field group that requires a Hubspot form to be placed on individual custom post types.
For example – Events Field Group
Event Title
Event description
Event speakers
Hubspot form code.
There is a different Hubspot form for each event and the Admin needs to enter this code in the Custom Post Type Events, to keep them from messing with the Elemntor template created specifically for Events. Normally I would just create individual event pages that are cloned from a master, but the client wants to have the events as a Loop.
Can this be done – A field for this code? I have tried the WYSIWYG and have tried the Text area with no formatting, but nothing seems to work.
ANY help is greatly appreciated.
Here’s the translation and correction:
As requested by user @Zek, I’m trying to find a way to display custom fields of a taxonomy in the pop-up that opens when creating a new term from the post edit screen.
Zek suggests a solution that overrides the ‘ajax_add_term’ function within the file advanced-custom-fields-pro/includes/fields/class-acf-field-taxonomy.php line 856.
Is there an alternative solution to avoid touching the plugin code and work from my theme’s function?
Original Topic:
https://support.advancedcustomfields.com/forums/topic/add-field-to-add_term-lightbox-in-taxonomy-field/
I’ve attached a screenshot of the pop-up for clarity.
Hi All
I am using:
Advanced Custom Fields
Elementor Pro
Lifter Elements
Lifter LMS
Astra Theme
I just watch this amazing tutorial https://www.youtube.com/watch?v=oSaDk9-GHJ8 and it is exactly what I need.
I want to put 3 links underneath each lesson video (as per my image).
My questions are:
Do I need to do the step with the Wysiwyg editor from this youtube video? Is that step required to create a space for the short code?
Can anyone advise how to set it up in Advanced Custom Fields: I want there to be one heading of “Support lessons Required” with a few support videos under it. I do not want it to repeat the heading “Support lessons” for each custom field of each link.
Thank you
I’m using parent/child blocks for an FAQ. The parent block is basically a wrapper for the FAQ items and has only one allowed block which is the FAQ Item block. This basically acts as a repeater field, but allows me to use the core Heading and Paragraph blocks inside the faq items.
Unfortunately there is a usability problem. It can be difficult to show the “add” button to add a new FAQ item. The only way it displays is if the parent FAQ block is selected. Ideally this button would always display either all the time or if any child within the parent FAQ block is active.
Is anyone else using blocks for something like this and found a workaround for the insert button?
Hi guys i am developing a plugin for my own purpose nothing commercial, it’s just a way to automate my future work and I am facing something peculiar, I admit I am not using the latest version of ACF because I am developing on localhost, I am not willing to use my licence on a localhost environment.
So this is not necessary a technical issue, I mean is something between frontend a backend, I admit I am able to fix this somehow but I need to know if there is a propper method to do it:
I have a big repeater field and there are conditions all around it, when it comes to display fields based on these conditions, will mess things around, spacings, etc.
this is the json Fields :
acf_add_local_field_group(array(
'key' => 'group_66125eef10578',
'title' => 'Slideshow',
'fields' => array(
array(
'key' => 'field_6614259e8d6f3',
'label' => 'Slideshow',
'name' => '',
'type' => 'tab',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'placement' => 'top',
'endpoint' => 0,
),
array(
'key' => 'field_661435860c17d',
'label' => 'Slideshow Post type',
'name' => 'slideshow_post_type',
'type' => 'select',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'choices' => array(
'multimedia' => 'Multimedia',
'products' => 'Products',
'gallery' => 'Gallery',
'posts' => 'Posts / Pages / Custom CTPS',
),
'default_value' => false,
'allow_null' => 0,
'multiple' => 0,
'ui' => 0,
'return_format' => 'value',
'ajax' => 0,
'placeholder' => '',
),
array(
'key' => 'field_66125ef55e8f9',
'label' => 'Slides',
'name' => 'slideshows',
'type' => 'repeater',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_661435860c17d',
'operator' => '==',
'value' => 'multimedia',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'collapsed' => '',
'min' => 0,
'max' => 0,
'layout' => 'table',
'button_label' => '',
'sub_fields' => array(
array(
'key' => 'field_66125f765e8fa',
'label' => 'Slide Type',
'name' => 'slide_type',
'type' => 'select',
'instructions' => 'Select the type of the slide you want to display',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '20',
'class' => '',
'id' => '',
),
'choices' => array(
'image' => 'Only Image',
'video' => 'Only Video',
'custom' => 'Custom Slide',
),
'default_value' => false,
'allow_null' => 0,
'multiple' => 0,
'ui' => 0,
'return_format' => 'value',
'ajax' => 0,
'placeholder' => '',
),
array(
'key' => 'field_6612a963f9b30',
'label' => 'Slide Custom Background',
'name' => 'slide_custom_background',
'type' => 'select',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_66125f765e8fa',
'operator' => '==',
'value' => 'custom',
),
),
),
'wrapper' => array(
'width' => '20',
'class' => '',
'id' => '',
),
'choices' => array(
'image' => 'Image background',
'video' => 'Video background',
),
'default_value' => false,
'allow_null' => 0,
'multiple' => 0,
'ui' => 0,
'return_format' => 'value',
'ajax' => 0,
'placeholder' => '',
),
array(
'key' => 'field_6614add9153df',
'label' => 'Apply overlay',
'name' => 'apply_overlay',
'type' => 'true_false',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '20',
'class' => '',
'id' => '',
),
'message' => '',
'default_value' => 0,
'ui' => 0,
'ui_on_text' => '',
'ui_off_text' => '',
),
array(
'key' => 'field_6614adfb153e0',
'label' => 'Overlay color',
'name' => 'overlay_color',
'type' => 'color_picker',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_6614add9153df',
'operator' => '==',
'value' => '1',
),
),
),
'wrapper' => array(
'width' => '20',
'class' => '',
'id' => '',
),
'default_value' => '',
'enable_opacity' => 1,
'return_format' => 'string',
),
array(
'key' => 'field_661260ac186f8',
'label' => 'Slide Image',
'name' => 'slide_image',
'type' => 'image',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_66125f765e8fa',
'operator' => '==',
'value' => 'image',
),
),
array(
array(
'field' => 'field_66125f765e8fa',
'operator' => '==',
'value' => 'custom',
),
),
array(
array(
'field' => 'field_6612a963f9b30',
'operator' => '==',
'value' => 'image',
),
),
),
'wrapper' => array(
'width' => '20',
'class' => '',
'id' => '',
),
'return_format' => 'array',
'preview_size' => 'medium',
'library' => 'all',
'min_width' => '',
'min_height' => '',
'min_size' => '',
'max_width' => '',
'max_height' => '',
'max_size' => '',
'mime_types' => '',
),
array(
'key' => 'field_6612a83ca59b6',
'label' => 'Slideshow Video',
'name' => 'slideshow_video',
'type' => 'url',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_66125f765e8fa',
'operator' => '==',
'value' => 'video',
),
),
array(
array(
'field' => 'field_6612a963f9b30',
'operator' => '==',
'value' => 'video',
),
),
),
'wrapper' => array(
'width' => '20',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
),
array(
'key' => 'field_6612a74c96a57',
'label' => 'Slideshow Text',
'name' => 'slideshow_text',
'type' => 'wysiwyg',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_66125f765e8fa',
'operator' => '==',
'value' => 'custom',
),
),
),
'wrapper' => array(
'width' => '20',
'class' => '',
'id' => '',
),
'default_value' => '',
'tabs' => 'all',
'toolbar' => 'full',
'media_upload' => 1,
'delay' => 0,
),
array(
'key' => 'field_6612a76a96a58',
'label' => 'Slideshow Text orientation',
'name' => 'slideshow_text_orientation',
'type' => 'select',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_66125f765e8fa',
'operator' => '==',
'value' => 'custom',
),
),
),
'wrapper' => array(
'width' => '20',
'class' => '',
'id' => '',
),
'choices' => array(
'left' => 'Align Left',
'right' => 'Align Right',
'center' => 'Align Center',
),
'default_value' => false,
'allow_null' => 0,
'multiple' => 0,
'ui' => 0,
'return_format' => 'value',
'ajax' => 0,
'placeholder' => '',
),
array(
'key' => 'field_6614277a8d6fa',
'label' => 'Slideshow interval',
'name' => 'slideshow_interval',
'type' => 'number',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '20',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'min' => '',
'max' => '',
'step' => '',
),
),
),
array(
'key' => 'field_6614b1ec5fc8f',
'label' => 'Gallery Slides',
'name' => 'gallery_slides',
'type' => 'gallery',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_661435860c17d',
'operator' => '==',
'value' => 'gallery',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'return_format' => 'array',
'preview_size' => 'medium',
'insert' => 'append',
'library' => 'all',
'min' => '',
'max' => '',
'min_width' => '',
'min_height' => '',
'min_size' => '',
'max_width' => '',
'max_height' => '',
'max_size' => '',
'mime_types' => '',
),
array(
'key' => 'field_661425b48d6f4',
'label' => 'Options',
'name' => '',
'type' => 'tab',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'placement' => 'top',
'endpoint' => 0,
),
array(
'key' => 'field_661425d48d6f5',
'label' => 'Slideshow Height',
'name' => 'slideshow_height',
'type' => 'select',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '33.3',
'class' => '',
'id' => '',
),
'choices' => array(
'px' => 'Pixels',
'vh' => 'View Port Height',
),
'default_value' => false,
'allow_null' => 0,
'multiple' => 0,
'ui' => 0,
'return_format' => 'value',
'ajax' => 0,
'placeholder' => '',
),
array(
'key' => 'field_661426208d6f6',
'label' => 'Height Number',
'name' => 'height_number',
'type' => 'number',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '33.3',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'min' => '',
'max' => '',
'step' => '',
),
array(
'key' => 'field_6614ad39baef8',
'label' => 'Inherit theme colors',
'name' => 'inherit_theme_colors',
'type' => 'true_false',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '33.3',
'class' => '',
'id' => '',
),
'message' => '',
'default_value' => 0,
'ui' => 0,
'ui_on_text' => '',
'ui_off_text' => '',
),
array(
'key' => 'field_6614264e8d6f7',
'label' => 'Display Arrows',
'name' => 'display_arrows',
'type' => 'true_false',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '33.3',
'class' => '',
'id' => '',
),
'message' => '',
'default_value' => 0,
'ui' => 0,
'ui_on_text' => '',
'ui_off_text' => '',
),
array(
'key' => 'field_6614acf4baef6',
'label' => 'Arrow Color',
'name' => 'arrow_color',
'type' => 'color_picker',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_6614ad39baef8',
'operator' => '!=',
'value' => '1',
),
),
),
'wrapper' => array(
'width' => '33.3',
'class' => '',
'id' => '',
),
'default_value' => '',
'enable_opacity' => 1,
'return_format' => 'string',
),
array(
'key' => 'field_661426618d6f8',
'label' => 'Display Indicator',
'name' => 'display_indicator',
'type' => 'true_false',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '33.3',
'class' => '',
'id' => '',
),
'message' => '',
'default_value' => 0,
'ui' => 0,
'ui_on_text' => '',
'ui_off_text' => '',
),
array(
'key' => 'field_6614ad1bbaef7',
'label' => 'Indicators color',
'name' => 'indicators_color',
'type' => 'color_picker',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_6614ad39baef8',
'operator' => '!=',
'value' => '1',
),
),
),
'wrapper' => array(
'width' => '33.3',
'class' => '',
'id' => '',
),
'default_value' => '',
'enable_opacity' => 1,
'return_format' => 'string',
),
array(
'key' => 'field_661426ca8d6f9',
'label' => 'Slideshow Sliding Effect',
'name' => 'slideshow_sliding_effect',
'type' => 'select',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '33.3',
'class' => '',
'id' => '',
),
'choices' => array(
'normal' => 'Normal Slide / Swipe',
'fade' => 'Fade in Slide',
),
'default_value' => false,
'allow_null' => 0,
'multiple' => 0,
'ui' => 0,
'return_format' => 'value',
'ajax' => 0,
'placeholder' => '',
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'evx_slideshow',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
'show_in_rest' => 0,
));
endif;
This is the image with the mess it brings :
In advance, i don’t need to help me developing a solution, i just need to know if there is something you guys know how to easy deal with or if i mistake something in my implementation of displaying these fields.
Cheers, Lucian.
Hey Guys i am using ACF field to show post update date but the thing is i have to manually change the date everytime what i want to achieve is ACF automatically change date in product page to actual product update date….
i hope my query is clear please help thanks
i am using date filed in product page and i am using this code to auto fill todays date but date update is not working automatically
add_filter(‘acf/load_field/name=updates_on’, ‘my_acf_default_date’);
function my_acf_default_date($field) {
$field[‘default_value’] = date(‘F j, Y’);
return $field;
}
I really need help or advice from experts. My task is to create a set of text fields in the field type=group (which is created in the admin panel) depending on the value of the post fields.
I’m actually making a table editor. The two repeating fields will contain the names of the columns and rows. Now I want to make a grid table with text fields. Calculate their % width (to make a view like a table) and add this unique set of text fields for each page.
But for example, I need to solve the simplest problem – create a subfield for an existing field group. I saw how to add a separate group of fields using PHP. But I want to change the set of fields in an existing (empty in the admin panel) group.
I would be eternally grateful for your help as it will open the door to many things in the future. Thank you!
I would like to use svg icons as radio buttons and have been successful using this technique from her: https://support.advancedcustomfields.com/forums/topic/radio-button-image-label/, but this seems to not work anymore. Maybe there has been added some kind of security/wp_kses filter? Has anyone been able to solve this recently?
Does anyone have a good way to completely stop oEmbed like pasting in a YouTube URL from working in the Basic WYSIWYG fields?
I know I could filter it out on the front end, but I want to stop it from working at all on the backed so editor users don’t get the impression that’s something they can do.
We would want it to keep working for “Full” WYSIWYG fields, but the places we implement the “Basic” WYSIWYG we’re trying to just offer bold, italics, links and that’s all.
Hello,
I am using Advanced Custom Fields PRO Version 6.2.7
Recently I have noticed that when I want to update a relationship field with multiple values, the whole ARRAY is not saved, but only the first value of the ARRAY.
I have used this code as a test:
update_field('menu', array(123,456), $post_id);
This is the output with var_dump:
int(123)
These are my settings for the relationship field:
{
"key": "field_60c789afded44",
"label": "menu",
"name": "menu",
"aria-label": "",
"type": "relationship",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"wpml_cf_preferences": 1,
"post_type": [
"product"
],
"taxonomy": [
"product_cat:new"
],
"filters": [
"search",
"taxonomy"
],
"elements": "",
"min": "",
"max": "",
"return_format": "id",
"bidirectional_target": []
},
Hi all, new here. I have a question and hope you can help.
Maybe ACF is the wrong tool, but i want to make a unique wordpress user role and custom profile that comes with it. I thought ACF could help with the custom fields for the profile. So ive made a field group and added all the fields. So far so good. Set it to show for the new user role and again, it shows in the admin area. However, i cant get it to show frontend.
I’d like the visitor with that role, to see the info on their account page and edit the profile if needed. Is there any way to use ACF for this, to make that work?
Of maybe i need a completely other way to realise these needs?
Any help is much appreciated!
Thanks in advance!
I;m trying to generated an ID saved with each individual Block of a specific type, I;m using the example given in the documentation but no joy, any ideas?
function generate_unique_block_id_for_acf_waveform_block( $attributes ) {
if ( isset($attributes['blockName']) && $attributes['blockName'] === 'acf/waveform' ) {
if ( empty( $attributes['anchor'] ) ) {
$attributes['anchor'] = uniqid();
}
}
return $attributes;
}
add_filter( 'acf/pre_save_block', 'generate_unique_block_id_for_acf_waveform_block', 10, 1 );
i am able to dispplay all the parents like this
//category manipulation for material and thickness at feaure page
function feature_hide_child_taxonomies($args, $field){
if (‘feature_product_select_material’ === $field[‘_name’]) {
$args[‘parent’] = 0;
}
return $args;
}
add_filter(‘acf/fields/taxonomy/query’, ‘feature_hide_child_taxonomies’, 10, 2);
now I want all childrens only but I am unable. please view my other code
function feature_show_parent_taxonomies($args, $field, $post_id){
$parent_id = get_field(‘feature_product_radio_size’,$post_id )[‘feature_product_select_material’];
if (‘feature_product_select_thickness’ === $field[‘_name’]) {
}
return $args;
}
add_filter(‘acf/fields/taxonomy/query’, ‘feature_show_parent_taxonomies’, 10, 2);
I’m struggling with an acf_form that collects a value then passes to a sub field in a repeater field.
Thanks in advance for any suggestions or help. I’m spinning in circles at this point.
I used this acf_form thread as a starting point. Concerned I’ve either over complicated what I need or missed something while customizing for my situation. I originally had have_rows() loop but changed it to what
s below since I want the user to be able to add a rating regardless of if there are rows or not.
The current form renders and partially functions but the value isn’t getting passed on the repeater sub field.
My last attempt was to track by adding error_log() throughout my acf/save_post, but am getting more confused on what/where the issue could be. I tried turning off all plugins except ACF, Oxygen, and my drop-in plugin.
Here are the details:
ACF Pro: 6.2.7
WP: 6.4.3
Theme: Oxygen Builder (actions/hooks are located in a drop-in plugin)
Front End Form (placed on CPT ‘business’ template):
<?php while ( have_posts() ) : the_post(); ?>
<?php acf_form(array(
'post_id' => get_the_ID(),
//'field_groups' => array('group_xxxx'), //previous attempt - field group contains front-end field and repeater with sub field (radio button)
'fields' => array(
'field_yyyy', // front-end field to collect data (radio button)
),
'submit_value' => "Share",
'updated_message' => "Thanks for Sharing!",
'form' => true,
'new_post' => false,
)); ?>
<?php endwhile; ?>
Actions/Hooks located in my drop-in plugin:
Load acf_form_head before get_header
//Add acf_post_type into pages before get_header...
add_action('wp_head', 'site_wide_acf_forms',1);
function site_wide_acf_forms() {
if ( get_post_type() == 'business' ){
acf_form_head();
} // end of IF statement
}
Action to pass value from form field to repeater field
//Hook frontend Form -> then pass value to Repeater
add_action('acf/save_post', 'my_acf_add_emoji', 15); //set to above 10 so acf/save_post grabs updated value
function my_acf_add_emoji( $post_id ) {
// Check the new value of the front end field.
$emoji = get_field('field_yyyy', $post_id);
// **TEMP DEBUG**
error_log("Value Before: " . $emoji);
error_log("Var Export Before: <pre>" . var_export($emoji) . "</pre>");
// Check if specific value was updated
if ( isset($emoji) ) {
// **TEMP DEBUG**
error_log("Var Export Isset: <pre>" . var_export($emoji) . "</pre>");
$max_rows = 1; // Set the maximum number of rows to add
$added_rows = 0;
while( $added_rows < $max_rows ) {
$row = array(
'field_yyyy' => $emoji, //Grab the FrontEnd field value
);
//Add a radio button value (sub field) to the Repeater..
add_sub_row('field_zzzz', $row); //uses field key for parent repeater
$added_rows++;
// **TEMP DEBUG**
error_log("Value Added Row: " . $emoji);
error_log("Var Export Added Row: <pre>" . var_export($emoji) . "</pre>");
}
}
}
FWIW, here’s a sample of the last error logs capture after I submitted the form:
PHP message: Value Before: 8
PHP message: Var Export Before:
.
PHP message: Var Export Isset:
.
PHP message: Value Added Row: 8
PHP message: Var Export Added Row:
Hi
I have a repeater that is present on around 2,000 posts. “Features”
A recent request from the client is for more than one block of Features
So I’ve put in a repeater that enables that “Features Blocks” which has nested “Features”.
But for the historic posts I have left the original repeater.
So in the Post Edit there are now two fields Features – a repeater with each row a Feature and Feature Blocks – a repeater with each row a set of Features – in turn a repeater with each row a Feature)
This is not very elegant and has the power to confuse (never too difficult with the average client)
What I would like to do (via phpMyAdmin) is to migrate the rows of the original repeater into the repeater contained in the first row of the new repeater.
Any pointers as to how I can do this?
Many thanks, Chris
PS I’ll also post this on the community forum.
Hello,
I am desperately trying to make the following query work:
$args = array (
'posts_per_page' => -1,
'post_status' => 'publish',
'post_type' => array( 'my-cpt' ),
'meta_query' => array(
'relation' => 'AND',
array(
'relation' => 'OR',
array(
'place_clause_1' => array(
'key' => 'place',
'value' => '"14979"',
'compare' => 'LIKE',
),
'place_clause_2' => array(
'key' => 'place',
'value' => '"8917"',
'compare' => 'LIKE',
),
),
),
'date_clause' => array(
'key' => 'date',
'value' => date('YmD'),
'compare' => '>=',
),
'heure_clause' => array(
'key' => 'time_start',
'type' => 'NUMERIC',
'compare' => 'EXISTS',
),
),
'orderby' => array(
'date_clause' => 'ASC', 'heure_clause' => 'ASC'
)
);
$cal_query = new WP_Query( $args );
It returns nothing, whereas the following query returns 1 result (which is what I would expect from the previous query as well…)
$args = array (
'posts_per_page' => -1,
'post_status' => 'publish',
'post_type' => array( 'my-cpt' ),
'meta_query' => array(
'relation' => 'AND',
array(
'relation' => 'OR',
array(
'place_clause_1' => array(
'key' => 'place',
'value' => '"14979"',
'compare' => 'LIKE',
),
//'place_clause_2' => array(
// 'key' => 'place',
// 'value' => '"8917"',
// 'compare' => 'LIKE',
// ),
),
),
'date_clause' => array(
'key' => 'date',
'value' => date('YmD'),
'compare' => '>=',
),
'heure_clause' => array(
'key' => 'time_start',
'type' => 'NUMERIC',
'compare' => 'EXISTS',
),
),
'orderby' => array(
'date_clause' => 'ASC', 'heure_clause' => 'ASC'
)
);
$cal_query = new WP_Query( $args );
I use ACF Pro 6.2.7 with WP 6.4.3 if it matters.
Hi
I’ve created a custom post type “Job offers” and some custom fields “Job details” with ACF. I want to display the custom field values on each Job offer post. To do so, I used Elementor (Free) and dynamic tags.
So far I am facing 2 issues :
– 3 of my custom fields are taxonomies. When using dynamic tags on Elementor, the id of the taxonomy is displaying instead of the value of the taxonomy, even if the configuration of the custom field seems right. My question is : how do I display the value of the taxonomy (ex: type of contract) instead of its id (ex:186).
– My 2nd issue is that I created some text boxes with ACF and when using dynamic tags on Elementor to display the content of this field for each post, the line breaks seem to disappear. Do you know how to avoid this to happen ?
Help would be much appreciated :’)
Thank you
Hello! I’m building a website with custom post types thanks to ACF (💖) along with Elementor, but I have a question. I want to maintain a specific structure for the CPT I have created. I have created a post type (surgery) and a taxonomy for it (surgery-cat).
This has created the following URL for the posts:
(post type) domain.com/surgery/surgery-name-post
And for the taxonomy domain.com/surgery-cat/surgery-cat-name
What I really want is for the URL to have the category name and for the category to work on its own showing the posts (I would do this with Elementor) and remove the post/taxonomy name from both.
Post type domain.com/surgery/surgery-name-post >>>>> domain.com/surgery-cat-name/surgery-name-post
Taxonomy domain.com/surgery-cat/surgery-cat-name >>>>> domain.com/surgery-cat-name
Is it possible to do this?
Thanks!!
This is a discussion in two parts.
First is a piece of code for getting CPTs from another Site on a Multisite Network
The second is a call for ideas on how I can filter this dynamically (like the Relationship field)
The custom post type is called partner
and the Select* field to load it into is called site7_partners
This was implemented as a Relationship field around 10 years ago and, although I did find that code, it no longer works.
function acf_load_partner( $field ) {
$field['choices'] = array();
switch_to_blog(7);
$args = array(
'post_type' => 'partner',
'posts_per_page' => -1,
'post_status' => 'publish',
'orderby' => 'title',
'order' => 'ASC',
);
$page_query = new WP_Query($args);
if ($page_query->have_posts()) {
while ($page_query->have_posts()) {
$page_query->the_post();
$field['choices'][get_the_ID()] = get_the_title();
}
}
wp_reset_postdata();
restore_current_blog();
// return the field
return $field;
}
add_filter('acf/load_field/name=site7_partners', 'acf_load_partner', 999, 1);
Hello,
I am using acf_form() calling a flexible content and trying to update it.
If i call all the flexible content e.g. "array( 'sections' )"
everything works well (i get all the layouts and submit button works without any issues, updating the post and showing the correct data.)
If i call a row of a flexible content e.g. "array( 'sections_0_data' )"
i get the first layout separately as a form in the front end with the right data of the post i need to update working fine without problem. But submitting the form is not working properly. $_POST has the right data i need to submit but they are not being saved in the post (it should update the first row of the flexible content).
Is this a bug? what am i missing?
i am uploading some photos of the work on both sides.
The second photo with the $_POST is after i updated the form changing the title to “111”. $_POST gives back 111 but the acf_form doesn’t update the data to the proper acf_field (flexible content first row etc. )as it should.
Hello, I hope someone could please advise on the following issues. We are trying to update ACF fields using a cURL (POST) from a different domain using PHP but no fields are updating.
ACF must have this basic feature ?
Any help would be appreciated.
// continued code
if (isset($response['id'])) {
echo 'Post created successfully with ID: ' . $response['id'];
$post_id = $response['id'];
$acf_update_url = 'https://website.com/wp-json/acf/v3/vehicle/' . $post_id; // Adjust the ACF endpoint
$acf_data = array(
'fields' => array(
'status' => 'draft',
'vehicle-status' => 'AVAILABLE',
'vehicle-visibility' => 'DISPLAY',
'vehicle-make' => 'Ford',
'vehicle-model' => 'Astra',
'vehicle-colour' => 'White'
)
);
// Close the current cURL session
curl_close($ch);
// Create a new cURL session for updating ACF fields
$ch_update = curl_init();
// Set cURL options for updating ACF fields
curl_setopt($ch_update, CURLOPT_URL, $acf_update_url);
curl_setopt($ch_update, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch_update, CURLOPT_POSTFIELDS, json_encode($acf_data));
curl_setopt($ch_update, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch_update, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Basic ' . base64_encode($username . ':' . $password),
));
// Execute cURL session for updating ACF fields
$acf_result = curl_exec($ch_update);
//var_dump($acf_result);
// Check for errors in updating ACF fields
if (curl_errno($ch_update)) {
echo 'Curl error in updating ACF fields: ' . curl_error($ch_update);
} else {
echo 'ACF fields updated successfully.';
var_dump($acf_result);
echo '<br />';
var_dump($acf_data);
echo '<br />';
echo $acf_update_url;
}
// Close the cURL session for updating ACF fields
curl_close($ch_update);
} else {
echo 'Failed to create post. Response: ' . $result;
}
}
Hello, i want to make ACF field display in admin-new-email template.
Hopping someone can help, i find this code, who displays my custom field in Cart page near price:
function order_review_custom_field($product_price , $cart_item, $cart_item_key){
$price= get_field('price_for', $cart_item['product_id']);
return ($price) ?
$product_price . '<div>/' . $price. '</div>'
:
$product_price . '<div> </div>';
}
add_filter('woocommerce_cart_item_price', 'order_review_custom_field', 999, 3);
And its shows really good. But now i want display it in email template, but now not near price, but near quantity. So its like PRODUCT NAME next column Quantity/(my custom field) And when Sub total. I hope you know what i mean.