Skip Navigation

[Resolved] Converting existing fields issue

This support ticket is created 4 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 13 replies, has 2 voices.

Last updated by NathanG920 4 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#1572343
Toolset Field.jpg

I'm trying to convert some existing post types that a previous developer created using 'Cuztom', which has all its own set of individual php files that control the custom posts. I've been following the directions of:

https://toolset.com/documentation/user-guides/custom-content/convert-existing-custom-types-and-fields-to-types-control/

The first section of re-creating all the custom posts in Toolset worked great, however the section for recreating the custom fields isn't working as none of the field details appear in Post Field Control. I'ts also not an option for me to recreate the fields manually as there are hundreds of posts with multiple fields which would take an eternity.

The fields seem to be generated via the functions.php file loading 'Nona-custom-posts-and-meta.php' which then contails all the details and slugs for the custom fields.

I've attached an example of what the fields look like if it helps at all, but unfortunately i'm working on the website offline so i cant provide a link to the backend.

Any advice would be greatly appreciated.

#1572643

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nathan,

Thank you for getting in touch.

Happy to see that you were able to successfully convert the custom post types to our Types plugin.

For the custom fields could you send me the code that is being used to generate these fields so that I can run a test here locally ?

Thanks,
Shane

#1572647

Hey Shane,

Thanks for getting back, how would you like me to send it? Also, do you want just the relevant file or would you like the other accompanying ones like cuztom.php and functions.php etc.

#1572669

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nathan,

What I really need is the relevant file that generates the custom fields. You can additionally just send the theme since this is what contains the field information.

You can upload the theme to google drive and then send the share link to me.

Thanks,
Shane

#1573637

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nathan,

So I've taken a look at this for you, however as it seems the fields are not able to be brought under Types control as you say.

I suspect that this is because of the method used to create the custom fields.

Normally if a custom field was created using another plugin such as ACF or even Woocommerce then these fields will show up.

You will need to keep these fields in your theme for the data to show up. Types isn't able to bring these fields under it's control.

Thanks,
Shane

#1573659

Hey Shane,

Thanks for looking into it, i felt like that might've been the case. However, I assume the fields created in the theme just pull the relevant stuff from the database via slugs? If such is the case, would it not be possible to remake the fields in Toolset and then pull the data in by using the same details?

I'm not averse at all to recreating the fields, they aren't too complex, and i'd obviously like to use Toolset for as much as possible because there's a lot more resources/help available, the only main thing i'm trying to avoid is having to input all the data manually again as the amount of individual posts would be too overwhelming. Is something like this possible instead rather?

Thanks,
Nathan

#1573667

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nathan,

If you recreate the fields then the slugs will be different. Toolset will add a wpcf- prefix to the fields so they won't be referencing your original custom fields.

What I can do for you is to check with our 2nd tier supporters on monday to see if it is actually possible to convert these fields.

If we re-create the fields then it is possible to use custom code to copy over the data into the new custom fields but I would like to check first.

Thanks,
Shane

#1573669

That'd be amazing, thanks so much for all the help. Really appreciate it.

#1573699

Hey Shane,

After digging a bit further i think i may have found a workaround, but before i committed to buying the extra plugin i wanted to get your opinion. It seems i could use WP All Export to export the CSV data of the custom posts on the old theme (including their fields), and then re-import them onto the new theme using WP All Import. The plugin needs the pro version to add in custom fields, but just having a look at what data is actually there in the free version it seemed like the data was present, so i thought it might work.

Obviously the idea is to still then bring it under control of Toolset, so 'if' it did work, would the newly imported custom fields data then be able to be converted over to Toolset in the original way according to the guide i started out with?

If you have any opinion on it please let me know.

Thanks,
Nathan

#1575725

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nathan,

This is one way to do it, because when you are importing the CSV files I believe the WP All Import plugin allows you to map the field data to specific custom fields.

Which means you should be able to Map your existing fields to the custom fields you've created in Types and it should populate the data through that means.

There is also another method that relies on some amount of custom code to copy over the custom field data from the existing fields to your types field.

What it would involve is that you write a shortcode that would loop through all the post and get their respective field data and then update the matching field that was created in Types.

Thanks,
Shane

#1576131

Hey Shane,

Thanks for following up on this. Which method would you recommend personally? The purpose of migrating all this stuff over to Toolset for me was so that it would be in a format i understand and can fix should any bugs arise, so ideally i'd prefer to get rid of as much of the old format and 'cuztom' stuff as possible so that i understand how the website works and don't have stuff on the website that i'm unfamiliar with - where if it breaks i don't know how to fix it.

Given that though, between remapping the data or using custom code which do you think would be the best way to go about this?

Thanks again,
Nathan

#1576191

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nathan,

Given the number of the fields that would be involved, it would be best if you go through with the Exporting as a CSV and then mapping the imports to the corresponding Types fields.

If it was less fields then the custom code method would be a better solution.

Thanks,
Shane

#1576211

Okay great. Thanks so much for all the help, i really appreciate it!

#1576215

My issue is resolved now. Thank you!