How can we help?
If you are looking for support for our PokaTheme, this is the place!
Home › Forums › PokaTheme support › Custom Fields
- This topic has 10 replies, 2 voices, and was last updated 6 years, 7 months ago by admin.
-
AuthorPosts
-
February 19, 2018 at 8:46 pm #1543Christopher WitteParticipant
Hi!
I have added a few custom fields into the theme.
When i add numbers into these fields some of them just disapears when i publish/updates the page.
What am i doing wrong?
Best
ChrisFebruary 19, 2018 at 8:48 pm #1544Christopher WitteParticipantFebruary 20, 2018 at 12:22 pm #1545adminKeymasterHi Christopher,
What is the procedure you followed in adding these new fields?
Have you added these new fields inside acf-metaboxes.php ?
If this is the case then it is very crucial that the IDs of these new fields to be unique.
For example “field_562a457b33100”.
You can generate unique strings with PHP function uniqid();February 20, 2018 at 2:54 pm #1547Christopher WitteParticipantHi,
I have added all of the 3 fields the same way – and the only number that stays in the review after i update is “Omsättningskrav”
Here are my custom fields – i have used unique IDs for all of them:
array (
‘key’ => ‘field_795cd78dabd4k’,
‘label’ => ‘Bonusbelopp (Bonusfiltreraren)’,
‘name’ => ‘Bonusbelopp’,
‘type’ => ‘number’,
‘instructions’ => ”,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array (
‘width’ => ”,
‘class’ => ”,
‘id’ => ”,
),
‘default_value’ => ”,
‘placeholder’ => ”,
‘prepend’ => ”,
‘append’ => ”,
‘maxlength’ => ”,
‘readonly’ => 0,
‘disabled’ => 0,
),
array (
‘key’ => ‘field_595cd78dabd5k’,
‘label’ => ‘Omsättningskrav (Bonusfiltreraren)’,
‘name’ => ‘Omsättningskrav’,
‘type’ => ‘number’,
‘instructions’ => ”,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array (
‘width’ => ”,
‘class’ => ”,
‘id’ => ”,
),
‘default_value’ => ”,
‘placeholder’ => ”,
‘prepend’ => ”,
‘append’ => ”,
‘maxlength’ => ”,
‘readonly’ => 0,
‘disabled’ => 0,
),
array (
‘key’ => ‘field_698cd78eabd4o’,
‘label’ => ‘Minodds (Bonusfiltreraren)’,
‘name’ => ‘Minodds’,
‘type’ => ‘number’,
‘instructions’ => ”,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array (
‘width’ => ”,
‘class’ => ”,
‘id’ => ”,
),
‘default_value’ => ”,
‘placeholder’ => ”,
‘prepend’ => ”,
‘append’ => ”,
‘maxlength’ => ”,
‘readonly’ => 0,
‘disabled’ => 0,
),February 20, 2018 at 4:39 pm #1548adminKeymasterIn the name it’s best if you keep it as simple as you can, remove the special characters, for example : Omsättningskrav -> omsattningskrav
Also change in all three fields from ‘type’ => ‘number’ to ‘type’ => ‘text’
Lastly the keys are created with uniqid() ? Because it is very important for these fields to be unique.February 20, 2018 at 6:39 pm #1549Christopher WitteParticipantThanks!
I hade just changed the ID of another key slightly – where do i run the PHP function to get a unique ID?
Is there somewhere else i need to create these variables to make them “saveable”? I think its wierd that they show up in the wordpress admin but that im not able to store any numbers in them
//Chris
February 22, 2018 at 8:13 am #1551adminKeymasterHi Chris,
You can try an online parser like http://www.writephponline.com/ and you can run the uniqid();
The main issues for not saving the data in custom fields are the IDs to be unique and the names to be valid.February 25, 2018 at 7:25 pm #1582Christopher WitteParticipantThis reply has been marked as private.February 27, 2018 at 2:55 pm #1596adminKeymasterHi,
I believe that the problem is misconfiguration in metaboxes array.
Just to be sure you can try to enable ACF options panel with:`add_filter(‘acf/settings/show_admin’, ‘__return_true’, 100);`
and try creating your fields with the Visual tool of ACF, if you still experience the same problems then indeed is something with the server configuration, if everything is saved correctly then you are doing something wrong in acf-metaboxes.php
February 27, 2018 at 3:38 pm #1601Christopher WitteParticipantHi,
Thank you for the reply,
Where do i add that line of code?
// Chris
-
AuthorPosts
- You must be logged in to reply to this topic.