Support » Plugin: Custom Post Type UI » Theme reference is everywhere in the generated code

  • Resolved skiabox

    (@skiabox)


    Hello guys.
    I am watching a plugin development tutorial and the author is using your plugin to generate a couple of custom post types.
    The problem with my case is that I see my theme referenced everywhere in the code in contradiction with the tutorial author’s code where the code has no theme references at all.
    Any ideas?
    Thank you very much!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    Good day @skiabox

    I have a hunch they may have recorded the tutorial before we released version 1.3.0 in early 2016. In that version of the plugin, we added the output of the active theme’s textdomain to the labels to help with internationalization. This is on the assumption that they’re moving away from using our plugin, and adding the registration to their theme instead.

    Perfectly safe to remove if you are putting the code elsewhere instead of having CPTUI handle the registration, but the internationalization help is the intent and why we added it.

    skiabox

    (@skiabox)

    Thank you sir for your rapid answer!
    The assumption you made about tutorial creation time is true.
    At least the part of the tutorial I am reading now was created back in 2015.
    Sorry for my naive questions but I am new to wordpress plugin development.
    What do you suggest that I do now since I am using your plugin to create another plugin?
    Remove theme references by hand?
    Thank you again!

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    No naive questions here, and I’m happy to help.

    If you’re for sure not wanting to display the labels and whatnot in multiple languages, then by all means you can. It’s not going to harm anything to leave them either, for what it’s worth. Just a case of say changing __( 'Movies', 'Customize' ) to Movies for the label setup.

    Also you caused me to ask a good question that we have an open issue for. What happens if there’s no textdomain set for a theme? So I have some investigation to do there to help make the plugin better.

    skiabox

    (@skiabox)

    So, if I get it right, I can remove all “twentyseventeen” references inside the code (this is my theme) without breaking any functionality?
    If I leave it like it is now, with all these twentyseventeen references, can somebody that uses another theme, use the final plugin at the end of the tutorial?
    Thank you so much for your help!

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    Just to clarify, the “Get Code” section of the Tools menu, is not what actually does the registering for you. It’s more an export feature that types up the basic code for you.

    If you and others are using Custom Post Type UI itself to handle all the registration, it doesn’t do anything with textdomains. If you want to just use CPTUI as a generator, that’s fine and a handy functionality that we don’t necessarily advertise, but it’s at that point where we drop in the textdomain for copy/paste usage.

    Internationalization/Translation is actually one of our weaker areas that we haven’t found a great solution for, since we store the labels in the database and hardcoded.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Theme reference is everywhere in the generated code’ is closed to new replies.