• Resolved tkgnewseed

    (@tkgnewseed)


    Hi. I am contemplating using CPT plugin to add all my future post types/taxonomies. However, have a lot of old post types/toxonomies and I wonder if I can get them to work with CPT plugin?

    Right now, i have code in the functions.php file that registered all the old post types/taxonomies and are displayed via on the admin menu. I want to get rid of the custom code in the functions.php file and just use CPT plugin. Is there a simple method to do this? Or do I have to do everything over again thus I will have to delete the old stuff and then use CPT plugin to create them again??

    Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    No need to delete any of the content, just need to make sure when registering with CPTUI, you make sure your name fields matchup. For example if your post type is “movie”, you’d want the name field in CPTUI to also say “movie”, and so on. Same thing with taxonomies.

    Content won’t need to be moved at all, as the way you’re doing it now isn’t storing information in any special way and CPTUI does the exact same, in that it doesn’t store in any special way.

    Thread Starter tkgnewseed

    (@tkgnewseed)

    Great answers. Thank you very much!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome ??

    Thread Starter tkgnewseed

    (@tkgnewseed)

    Hi. I have to yet to move forward on this, but I have one small question.

    When creating these post types, where does it get stored? Right now I have my old code in functions.php and I want to know where in the file structure does CPT UI codes are stored at.

    Thank you.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    When you register a post type or taxonomy with CPTUI, the arguments get stored as an array of values in the options table. Then when it comes time to do the actual registering, we fetch the option and loop over that array, passing each part appropriately through register_post_type() or register_taxonomy().

    So we register via code, but we store the intended settings via options.

    In case curious what that looks like, you can check out https://github.com/WebDevStudios/custom-post-type-ui/blob/1.13.5/custom-post-type-ui.php#L335-L557 to see it all. Most particular would be the register_post_type() call on line 556.

    Thread Starter tkgnewseed

    (@tkgnewseed)

    Thank you. That makes sense.

    I did finally get the old post types and taxonomies over and all is working well. The last question I have is how to sort the child links of the admin menu.

    My parent and child as follows:

    Brands
    –All Brands
    –Add New
    –Occasions
    –Store Type
    –States
    –Categories.

    I want to be able to move Categories to be before Occasions.

    Thank you.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    That part I’m not sure about, as that’s not something that we have a hand in with CPTUI

    Thread Starter tkgnewseed

    (@tkgnewseed)

    Thank you. It’s not of high importance but it’s something I might like to do later. Since you don’t have that support, I will have to use PHP or a plugin that will reorder them. Again, thank you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Migrate Old Code over to CPT?’ is closed to new replies.