I have no problem in showing it. I’m having issue with putting the form.
But thanks anyway.
If it were me I wouldn’t be trying to insert the content of flexible content into the main content area. I’d simply be using flexible content and building a front end template that displayed it the way I wanted
This is what I wanted to achieve now. Can you guide me along on what and how this can be done?
I really have no idea how WordPress works and with all the different extension and so on.
Sorry but I still couldn’t figure out your advice.
This ['field_55ee67fc0ce35']
is to let user select the no of column per row. So if they select 3 then it will be 3 column. If they select 2 it will become 2 column and so on. This was supposed to behave exactly the same page builder for the front end form. I get the idea from the video in here.
I was thinking of simplifying this. Will it be simpler if my post has flexible content layout and I insert it into the post custom field rather than the content.
What will I need to replace/add
$post = array(
'post_type' => 'post', // Your post type ( post, page, custom post type )
'post_status' => 'publish', // (publish, draft, private, etc.)
'post_title' => wp_strip_all_tags($_POST['acf']['field_55e95e746593e']), // Post Title ACF field key
'post_content' => $_POST['acf']['field_55e95e8b6593f'], // Post Content ACF field key
);
to do so?
This is what I get saved save the form
Array
(
[_acfnonce] =>
[_acfchanged] => 1
[acf] => Array
(
[field_55e95e746593e] => Sample Article
[field_55e95e8b6593f] => Array
(
[55f1131e17718] => Array
(
[acf_fc_layout] => 3_columns
[field_55ee67fc0ce35] => 3
[field_55ee68170ce36] => lorem ipsum
[field_55ee683b0ce37] => lorem ipsum
[field_55ee8f67a0990] => lorem ipsum
)
[55f1132e1771c] => Array
(
[acf_fc_layout] => full_column
[field_55ee687d0ce3a] => lorem ipsum
)
)
[field_55e95eb365940] => Array
(
[0] => 64
[1] => 63
)
[field_55ee8eb9f1c6d] =>
[field_55e95efb65941] =>
[field_55efc8e15d926] =>
)
)
field_55e95e746593e = Title (Text)
field_55e95e8b6593f = Content (Flexible Content)
55f112041f2e9 = ??
field_55ee67fc0ce35 = Select with 3 value
field_55ee68170ce36 = Column 1 (Wysiwyg Editor)
field_55ee683b0ce37 = Column 2 (Wysiwyg Editor)
field_55ee8f67a0990 = Column 3 (Wysiwyg Editor)
field_55ee687d0ce3a = Full Column (Wysiwyg Editor)
field_55e95eb365940 = Category (Taxonomy)
field_55ee8eb9f1c6d = Adding New Category (Text)
field_55e95efb65941 = Featured Image (image)
field_55efc8e15d926 = Anoter Content (Wysiwyg Editor) – This is the initial content field I used before using the Flexible Content
As mention earlier, my initial intention was to create something similar to the capability of Page Builder. The reason I need to use Page Builder because the site I am working on allowed registered user to submit article.
And I will like to avoid the registered user to access our back-end thus we use ACR PRO form. And Flexible Content is the closest I can get to Page Builder.
You mention this
flex content field will be in a nested field
. Perhaps you can assist me how am I going about to do it?
My intention is to combine both post_id and user_id hoping to get field that is very specific to it and use update_field to change the content.
After experimenting a while I realised that is not possible to combine both (maybe I am wrong).
Anyway I decided to use wpdb to delete the field and update the content.
Nevermind I found my solution here
I just need to wrap the function with if $query->is_main_query()
statement.
if ($query->is_main_query()){
// get original meta query
$meta_query = $query -> get('meta_query');
// allow the url to alter the query
// eg. ?district=1
// eg. ?district=2
if (isset($_GET['district']) ){
$district = $_GET['district'];
$range = explode(' - ', str_replace('$', '', $_GET['price-range']));
//add meta query to the original meta queries
$meta_query[] = array(
'relation' => 'AND',
array(
'key' => 'district',
'value' => $district,
'compare' => 'IN',
),
array(
'key' => 'price',
'value' => $range[0],
'type' => 'NUMERIC',
'compare' => '>'
),
array(
'key' => 'price',
'value' => $range[1],
'type' => 'NUMERIC',
'compare' => '<'
)
);
}
// update the meta query args
$query -> set('meta_query', $meta_query);
//always return
return;
}
I have narrowed it down that the district is the problem. When I am filtering without the district the menu appear. Specifically if I remove the district%5B%5D, the menu appear but with it then it will disappear.
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.