Hi Shane,
Since my last message I have been doing soem further digging.
For the date issue, I am still confused as to why a custom shortcode is needed. When I look at the database, the database values written by Easy Content Types are as follows:
+---------+---------+-----------+------------+
| meta_id | post_id | meta_key | meta_value |
+---------+---------+-----------+------------+
| 1352 | 640 | ecpt_date | 1272326400 |
| 1383 | 678 | ecpt_date | 1305590400 |
+---------+---------+-----------+------------+
I created a date field in Toolset and the values are as follows:
+---------+---------+---------------+------------+
| meta_id | post_id | meta_key | meta_value |
+---------+---------+---------------+------------+
| 36006 | 13440 | wpcf-testdate | 1594339200 |
+---------+---------+---------------+------------+
Both are writing standard unix timestamps so I don't understand why Toolset won't pick up the value? I do see that the interface won't let me choose the date format (presumably because you're trying to avoid issues where plugins have written dates as text or something else) but is there not a way to force a situation where the data is used as is? For example, can I not overide the interface by manually modifying the configuration of the custom field to be a date in the database (or wherever Toolset is storing it)?
My issue with a custom shortcode is that entries added in the future won't work because Toolset doesn't see the field as a date and so doesn't provide the correct UI. I really need to find a way to have the old and new entries work properly.
I have found that the handling of the repeatable field is going to be more difficult. I was trying to display it using a 'repeating field' block. I have now learned that repeating fields aren't a standard feature and the issue I'm having is because of a different in the way they're handled in Toolset.
I created a new repeating field in Toolset and the data looks like this:
+---------+---------+----------------+--------------------------------------------------------------------+
| meta_id | post_id | meta_key | meta_value |
+---------+---------+----------------+--------------------------------------------------------------------+
| 36005 | 13440 | wpcf-filething | hidden link |
| 36004 | 13440 | wpcf-filething | hidden link |
| 36003 | 13440 | wpcf-filething | hidden link |
+---------+---------+----------------+--------------------------------------------------------------------+
You are writing a separate database entry for each item (and I think there's another entry that controls the sort order)
When I look at one of the Easy Content Types repeating fields it looks like this:
| 34702 | 12781 | ecpt_alternativeformats | a:2:{i:0;s:75:"hidden link";i:1;s:76:"hidden link";}
ECT encodes all the entries in one database row, giving their lengths, and the display order. Annoyingly, the format is a bit like JSON, but isn't JSON so it needs custom decoding.
I suspect that the only way to convert it is to write custom code to read the ECT entries, parse them out, and then add them back as Toolset entries. I am an ok coder, but I'm not really familiar with php or the internals of WordPress so I think it's going to be a bit of a slog.
My thought is that I need php code to pull all the custom posts out, and loop through them reading the ECT custom fields, then writing out Toolset ones. Once that's done, and assuming it works, I can just remove the ECT entries from the database.
I'mve written some WordPress loops before so I'm happy with the reading side of it, but are you able to give me any pointers as to how I can safely write back Toolset compatible entries? are there any exposed functions that I can call?
Thanks,
Dave
|