Templ33t

Templ33t is a WordPress & WordPress MS plugin that adds tabs to the edit page for custom content blocks using enhanced theme-specific configuration and smart template switching.

Templ33t-Screenshot

Templ33t is based on the MultiEdit plugin by Page.ly. I stumbled across it while searching for a better way to offer custom page templates to the users of a multi-site wordpress installation I manage. MultiEdit is great but I needed to offer my novice users a more fluid, CMS-like flow when it came to activating and using the templates. Many improvements are planned, stay tuned!

Download the latest verstion from WordPress.org

Features

  • Adds tabs to page edit area for content blocks
  • Auto-generation of custom fields
  • Smart Template Switching (aware of templates containing blocks)
  • Simple XML configuration

Configuration File

Place a file called templ33t.xml into any theme you would like to enable custom code blocks in. The XML should follow this structure:

    


    

You can add as many <template> elements as you wish and as many <block> elements within those. <block> values should key-safe and contain no spaces or special characters. Underscores are filtered to spaces when the tab labels are generated.

Templates

To output custom block data in your templates, use the following code:

// output content block
templ33t_block('Custom_Block_1');

Multi-Site/Must-Use Setup

To force this plugin across all sites on a multi-site installation of wordpress (or wordpress mu), take the following steps:

  1. Copy templ33t directory to mu-plugins
  2. Move templ33t.php to parent directory (mu-plugins)
  3. Open templ33t.php and change the TEMPL33t_ASSETS definition to WP_CONTENT.’/mu-plugins/templ33t/’

That’s all there is to it!


25 thoughts on “Templ33t

  1. Will Lanni

    Hello! I’m looking at this and at the multi-site plugin you based this on. I’m struggling to understand the difference–this will work with custom themes, is that right? I use Thematic, and build out child themes. Multi-edit/templ33t looks like the solution I need, I’m just curious what the actual difference is?

    Reply
  2. Will Lanni

    I got a series of errors trying to set this up.

    http://revebeds.com/home/

    set up the templ33t xml to look for home.php

    Set up the home.php with a series of divs that include the templ33t_block call.

    Created a new page, set it to the template, refreshed. The tabs appeared. entered content in.

    When I went to preview the page, I see

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/revebed1/public_html/wp-content/plugins/templ33t/templ33t.php on line 281

    any ideas?

    Reply
  3. Ryan Post author

    Hiya, Will. The difference in this early version is mainly how Templ33t handles creating the blog options and post meta and detects template switching. It requires one less reload and notifies you to reload when switching templates. When I tried multi-edit, I had to select the template, save the page, then reload twice (had to figure that out) to get the blog options, post meta and tabs.

    There is a new version coming soon that I’ve been working on for a few months that has a new GUI for configuration, works in both html and wysiwyg mode, makes custom content searchable, uses child plugins that allow you to use other form fields besides the editor, and allows you to add custom settings as well as content.

    As for the errors you’re experiencing, it sounds like the get_post_custom() function is returning something other than an array, which is strange. What version of wordpress are you using? Can you add something like “echo print_r($templ33t_available);” before that line in the file and respond with the results so I can get a better idea of what’s being returned?

    Reply
  4. Will Lanni

    Hey Ryan,

    I wound up removing templ33t from that particular site and using page.ly’s plugin.

    However, I’d love to get your plugin to work, and have added it to a different site, which is on a multi-site enabled wp install.

    I created a mu-plugins directory, as there isn’t one by default with the latest wordpress and multi-sites enabled. That mu-plugins directory is a sibling to the plugins, themes, upgrade, and blogs.dir directories. Does that sound right? I then edited the temp33t.php file’s templ33t_assets function.

    At this point, I’m struggling to figure out why the zones aren’t showing up at all. I’m using thematic, and developing out a childtheme — have you ever used templ33t with a theme framework like thematic?

    I also placed the print_r($templ33t_available) command into my file. It returned: Array ( ) 1

    I tried adding echo print_r($templ33t_file); to see if it would show where it thinks the template directory is, and all it returned was a ’1′.

    http://wp.redcardstudios.com/altego

    Reply
  5. Will Lanni

    Ah. OK, so I copied the templ33t.xml into the thematic theme directory, and the zones showed up in the page edit, even though the child theme is the one using the template. So… that’s interesting, and potentially problematic, as I use thematic for my theme development. This will mean that I can never duplicate a template page name across site child themes, which I can avoid, but it’s worth looking into how to work around that.

    Reply
  6. Ryan Post author

    Thanks for the extra info :) The issue is the way Templ33t finds the theme directory, which happens to point to the parent theme when dealing with child themes. It should be a simple fix. I’ll take a look and toss up the changes shortly.

    Reply
  7. Ryan Post author

    Okay, replacing all instances of get_template_directory() with get_stylesheet_directory() should fix the issue. I will release this change with the next version. Let me know if you find any other issues :)

    Reply
  8. Ihatetomatoes

    Hey Ryan,
    I had no issues setting your plugin up, great work.

    I’m just having small issue when I delete content form the WYSIWYG in CMS, it still renders empty in the front-end.

    Any idea how to fix this?

    Reply
  9. Ihatetomatoes

    Sorry it deleted the html markup. Could you update my previous comment? it still renders empty paragraph with break inside… Cheers

    Reply
  10. Ryan Post author

    The templ33t_block function doesn’t actually append any of it’s own HTML to the content, so any extra paragraph elements you see would be left over from TinyMCE’s assault on your content ;) The next version of this plugin allows you to use generic textareas and other elements to avoid situations like this.

    Some day, I will actually find the time to finish it, heh.

    Reply
  11. Will Lanni

    Hello Ryan,

    So far, so good. Using very unique page template names, I’m totally avoiding any problem with the xml showing up in the theme. One thing that is happening: we transferred a site using templ33t from one host to another. I’m not sure if my client has uploaded the xml sheet — I’m assuming they did, as the content is showing up properly. But the tabs in the different subsite pages are not. Have you ever had any issues transferring the plugin from one host to another? Would the tabs not show up, but the content show up correctly if it’s been styled, the plugin exists, the html/php exists in the template pages, but the xml doesn’t exist yet?

    Reply
    1. Ryan Post author

      @Will, sorry for the delayed reply. I have so much going on lately it’s difficult to keep up. I have not had any issues transferring from one host to another, no, but I’ve only had to do it once. It’s been a while since I’ve been able to look at the original code, but I believe on the front side the content simply checks for the area custom field and displays the content if it exists. So yes, it is possible for the content to show up even though the XML file is not where it aught to be.

      Reply
  12. Andrew Keith

    Hi Ryan, great plugin.

    Is there any chance that a future update could process shortcodes in the teml33t blocks? I’ve modified the plugin for a client to get this to work (added a call to do_shortcode in the templ33t_block method).

    Andy

    Reply
  13. Zac

    Love this plugin, it’s almost perfectly brilliant! Any idea why it won’t accept iframes though? Need to embed video from vimeo/youtube and it doesn’t like it much, just deletes the code.

    Reply
  14. Zac

    I’m a dick!

    Did a little bit more research and of course wordpress’ tinyMCE strips out iFrame code as a ‘feature’, if anyone’s interested I found a workaround bit of code for that here that goes in the functions.php file: http://pastebin.com/rKuewx0P

    Always learning, always forgetting

    :c)

    Reply
  15. Zac

    Hi, me, the Dick again, don’t suppose you have an ETA for supporting shortcodes? This would be unutterably cool functionality to have. I’d even pay you every time I used your plugin for a paid project :c)

    Reply
  16. Louis W

    Any estimation of when new version would be out? I would really like to use this for a project, but do not want to have full wysiwyg editor.

    Reply
  17. Jedidiah Hurt

    I tend to disable the visual editor on my clients’ sites due to its irksome HTML generation tendencies. Would it be technically feasible to modify this plugin to work without TinyMCE? I’m willing to dig into the code and take a look around, but figured it might be easier to get some counsel from the plugin author first. Thanks!

    Reply
  18. Ryan Post author

    Louis, I have a task at work that requires the new version of Templ33t and it should be bumped up fairly soon, hopefully in the next few weeks (but I’ve said that before.). The hurdles left to tackle include auto-detecting Templ33t blocks, simplifying the new GUI (no more XML) and handling special templates.

    Jedidiah, yes it is feasible and the new version has support for a variety of field types in addition to TinyMCE. I’m also adding support for page settings, which act like blocks but are all grouped under a single tab and return values rather than printing them. Stay tuned!

    Reply
  19. Michael

    I cannot get the tabs to show up in my editor at all. I am not using multi-site, so I put the plugin in the usual place. Then, I placed the .xml file in my theme directory, and fired up a new page in the editor. But no tabs. The JS and CSS for Templ33t are being added to the document, but no markup in the body of the page. I had this same issue with MultiEdit, which is why I went looking for an alternative. Is there possibly a conflict with some other plugin? The only other thing I have running is WP eMember. Any insight is appreciated.

    Reply
    1. Ryan Post author

      I know it has been a while and I apologize. If you post your configuration here, I will take a look. It should be noted, however, that this version of the plugin has not been tested with the latest versions of WordPress. I will find time for the rewrite evenutally.

      Reply
  20. Phill

    First I’d like to say – GREAT PLUGIN, it makes life so much easier and intuitive for my clients.

    I’ve experienced some strange issues with this and the original Page.ly plugin with a number of websites. When you edit one of the content area’s in HTML mode then click update – the whole of the content area that you edited is written to the Main tab (i.e. the area that contains the loop).

    I’ve also found that in IE8, if you make changes in the normal editing mode to one of the tabs, the same thing happens. Anyone have this issue at all? Any idea’s why it’s happening and how to stop it?

    Reply
    1. Ryan Post author

      Templ33t uses the same text area for all tab content and switches the values between it and some hidden fields (more efficient than loading multiple instances of the rich text editor). When the page is saved, Templ33t is supposed to automatically select the main tab before the post is made in order to sidestep the problem you’re seeing. If this is not happening, it is likely that a JS error or change in the WordPress DOM is preventing the event handlers from being triggered.

      This plugin has not been updated in some time and may not function with the latest versions of WordPress. As soon as I have time for a rewrite, this will become a priority. I have many additional features planned that will really take this plugin to a new level of awesome :) Please stay tuned.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>