Customizer Usage in eNewsletter

Sorry this is not a direct support question. I am hoping you can at least steer me in the right direction... I have been working on a plugin in my spare time and when I saw the way eNewsletter uses the WP Customizer it all came clear :wink: I have spent the last few days working with the code etc. for the customizer and it is working great. I have run into a problem though that I can't seem to find an answer to anywhere. I want my plugin to use the Customizer on it's own like eNewsletter does... meaning that I don't want the Current activated themes settings mixed in with my plugin settings (I hope you follow what I mean). I can't seem to figure out how to do this.

  • Tyler Postle
    • CGO

    Hey Missterbig,

    Hope you're doing well today and thanks for your question!

    Have you taken a look at the builder code for enewsletter? /wp-content/plugins/e-newsletter/email-newsletter-files/builder - perhaps that will help you on your hunt here :slight_smile: I'll admit this sort of request is a bit above my level of PHP knowledge; however, if you're still needing assistance after this I'll see if I can get a hold of one of the devs to get an answer for you :slight_smile:

    Look forward to your reply!

    All the best,
    Tyler

  • Missterbig
    • Site Builder, Child of Zeus

    Hi Tyler,
    Thanks for the fast reply. Yes I have been looking at ALL of the files in hopes of seeing how they did it. This is a very clever use of the Customizer indeed.
    If you could ask the developer or whoever I would sure appreciate it as I just can't seem to find anything written about this in the codex or online. It is my hope that this is a simple line of call up code that I am just missing. I am sure it won't turn out to be that simple but one can hope :wink:

  • aristath
    • Recruit

    Hello again @Missterbig, I hope you're well today!

    Actually I was looking at the implementation a couple of months ago because I agree... It's an ingenious and creative use of the customizer!
    The key thing is the use of the register_theme_directory() function in the e-newsletter/email-newsletter-files/class.functions.php file.
    What this does is register a new theme directory for the "themes".
    Then you create a theme in that directory that you just registered and use the Customizer API to add the options in the customizer.

    I hope that helps! :slight_smile:

    Cheers,
    Ari.

  • Missterbig
    • Site Builder, Child of Zeus

    Oh Hi Ari are you not one of the developers of Kirki as well? I am also using Kirki I love it :wink:

    I will likely have to give what you said some more thorough thought but you are aware that I am creating a Plugin and NOT a theme right? Or are you just suggesting this as a way of getting a new instance of the Customizer for my plugin?

  • Tyler Postle
    • CGO

    Hey Missterbig,

    Yes, I believe the method Ari mentioned above is correct for a plugin, because you are creating a "theme" directory to use for templates that you edit with the customizer. In this case, the "themes" will be your enewsletter templates, not actual WordPress themes.

    I'll let Ari reply to your Kirki comment next time he's on :slight_smile:

    Let us know if you have any further questions!

    Cheers,
    Tyler

  • aristath
    • Recruit

    Oh Hi Ari are you not one of the developers of Kirki as well? I am also using Kirki I love it :wink:

    Yeah, Kirki is one of my babies. I'm glad you like it! :slight_smile:

    Ah yes it says it right there in the codex... "Register a plugin's subdirectory as a theme folder" Now we are cookin'

    I'm glad you found it! Sorry it took me so long to reply, I was offline for a few days. It's a pretty convenient and pretty "unique" way to use the customizer!

    If you need any help with this then please don't hesitate to post back here!

    Cheers,
    Ari.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.