- August 31, 2018 at 3:12 PM #11186Resolved
I don’t know, if there is somebody, who read tasks, that are marked as “resolved”. So i create new topic.
In your latest plugin upgrade this “Saved value 0 for switch field when it’s off.” didn’t work. I have reported this probably a month ago.
Your support is very poorly :/
- August 31, 2018 at 3:17 PM #11188
Sorry for the late reply. In the previous topic, I marked it as “resolved” when I pushed the commit that I thought it fixed the bug.
Let me check it again and will reply you soon.August 31, 2018 at 3:40 PM #11189August 31, 2018 at 4:05 PM #11190
fix is ok. (i must resave every post (thousands of posts)) to work with this.
One more question: if i would like to have default value in “datetime” filed, what can i do? If i set “std => ‘ ‘” (white space string), i get “0” ind DB – it’s ok?August 31, 2018 at 4:23 PM #11191
I’m sorry for the “re-save”. You can write a script to help you doing this.
datetimefield, if you set
'std' => ' ', then when saving the post without specifying the datetime, it will save exactly as
' 'in the database. Actually, the plugin treats datetime field like a text field, unless you set
'timestamp' => true, which converts datetime into integer. And then in that case, the value is kind of unexpected, cause
' 'is converted to incorrect value.August 31, 2018 at 4:41 PM #11192
I have this:
array( 'name' => __( 'Show until', TEXTDOMAIN ), 'id' => $prefix . 'show_until', 'type' => 'datetime', 'size' => 20, 'js_options' => array( 'regional' => 'cz', 'appendText' => '', 'dateFormat' => 'yy-mm-dd', 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => false ) ),
What i have to do, if i would like default (empty?) record in DB (like 0 in switch)? The reason is, that i must query posts with conditional test EXISTS on this field – this is performance issue on larges sites..September 1, 2018 at 8:30 AM #11201
I’ve tried your code and it’s working correctly. There is no ‘0’ saved in the DB. Please see my video:September 1, 2018 at 4:20 PM #11219
i don’t know, how i get 0 in DB with ‘std’ => ‘ ‘, but now it’s really empty.. :/ Nevermind. Back to my last question. Is there a way to have default value for field “datetime”?
There is basic setting for fields ‘std’ .. but how it works? For example i have this:
‘name’ => __( ‘URL’, TEXTDOMAIN ),
‘id’ => $prefix . ‘url’,
‘type’ => ‘text’,
‘std’ => ‘test’
If i don’t fill this field and save the post, than this field doesn’t exists in DB. I forgot something?
Is there a way to have ‘std’ setting work with datetime field? If so how?September 2, 2018 at 9:36 PM #11226
stdis what you want. But it’s applied (e.g. show) only when the meta box hasn’t saved. So, if you have saved the meta box once, the field won’t show the
stdvalue. You can check that with new post, where the meta box hasn’t been saved and you’ll see the
stdvalue is showing.September 2, 2018 at 10:55 PM #11227
OK, thank you for your support.
You must be logged in to reply to this topic.