[theme-reviewers] Theme name slug question

Shinra Web Holdings shinrawebholdings at gmail.com
Thu Sep 6 17:16:48 UTC 2012


The problem is if you're using the same slugs in more than one project you
run the risk of defining functions twice, which will break PHP. You could
prefix every function with if( !function_exists( 'sameslug_function_name )
), but then you just end up typing more, not less. On top of that you risk
older versions of those functions being run expecting newer results, or
running a completely unrelated function that's in your  namespace
improperly.

If you really have to reuse code, I guess the safest way would be to put it
in a custom class and do a version check each time you create an instance.



On Thu, Sep 6, 2012 at 12:00 PM, Bruce Wampler <weavertheme at gmail.com>wrote:

> I have a question about using the theme slug. One of the important goals
> of the slug is to create a "namespace" for the theme, and as far as I know,
> the interpretation has been to have every theme use its slug on all names.
> But this brings up an issue.
>
> I have an existing theme (Weaver II) and its slug 'weaver-ii'. It is a
> large theme, and has lots of support functions.
>
> I'm now thinking about developing a smaller version of the theme - called
> Weaver Mini, perhaps. Now, since I "own" the slug 'weaver-ii', would it be
> acceptable to reuse all that support code in the new theme (slug
> 'weaver-mini') while keeping the 'weaver-ii' name for the support code.
> Would make maintenance a lot easier, and it seems it preserves the intent
> of the theme slug rule.
>
> Seems like a general policy on this could be really helpful for lots of
> theme developers who reuse code. Might even want to extend it to allow
> re-use of other theme libraries. I suspect there is code in my theme's
> support code that could be useful in other themes, and allowing reuse of my
> slug in other themes would help maintenance issues for sure. Since only one
> theme is active at a time, this seems like a safe way to preserve
> namespaces.
>
> Bruce Wampler
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20120906/d6149739/attachment.htm>


More information about the theme-reviewers mailing list