Enzymes 1.2 Released Today

Changes

  • Fixed a bug in the metabolism outside a post. For example, a title transcluding a custom field by means of an implicit reference rendered correctly when viewing the post but not when the title appeared in a list of post titles.

Files

9 Replies to “Enzymes 1.2 Released Today”

  1. For some reason, I want to transclude a custom field in the style sheet. However, it failed with Enzymes. Is it possible to transclude a custom field in an indepedant file other than the normal template files, say in php or php enabled dynamic css files? This can be workarounded by inline style which is invalid for xhtml 1.1. Any comments are welcomed. Thanks in advance!

  2. Enzymes is a WordPress plugin, and as such it needs the environment provided by WordPress, i.e. the files included by WordPress before getting to the template system… Maybe not all of them, but many.

    If you want to use your php/css file by means of a link tag in the head of a page, I think the best you can do is byass WordPress and access the database directly, submit your SQL query, and get the custom field values back: it shouldn’t be difficult.
    You can look for the declaration of the get_post_meta() function in the WordPress files, and manually build the subset of all the functions needed for it to work. It’s a bit tedious, but almost an easy task.

    But if you want to use your php/css file in a WordPress page anyway, then you should insert in the header.php file a style element with the content of your php/css file. This way, the environmet is correctly loaded and you can also use Enzymes for transcluding custom fields.

  3. Thanks for your informative reply.
    Actually I have the following scenario: I put an image url in a custom field called bgurl and I want to apply it to the first part of each post as background image. I can use {[.bgurl]} everywhere in the post but not in the external css file. I wonder if I can “include” enzymes functions and wp’s defalt functions so that I could realize the purpose with ease using dynamic css file generated by php.
    The main imperfectness of enzymes is that I can’t transclude out of the loop. I find some other plugins do support this feature. So would you please consider adding it in the near future? In fact they are some sql querries as you said.

  4. You certainly can “transclude out of the loop”, by means of the metabolize function, which gets any Enzymes statement as an argument.

    EG:
    «?php metabolize( ‘{[123.hello(456.world) /some/template.php]}’ ); ?»

  5. Hi, great plugin, very useful.

    Is there a way to use the post slug instead of post id when doing things such as {[123.hello]}, I would rather use {[post-slug.hello]} which would be much easier for using this syntax by hand in miscellaneous posts.

    Thanks

  6. Hi, one more request:

    I would like the templating function to be able to access more than one custom field from a post. So, instead of passing the custom field to the template I would pass the post id (or post slug). I would then like to access multiple custom fields, format the output using php and some logic, and then return the content.

    As I understand it now, you can only pass one custom field to be used in the template function.

  7. One last question about the usability of this plugin. Does the wordpress search function know how to parse out the content of enzymes?

  8. Sorry for the late reply: I was on vacation.

    The slug idea is brilliant. I’ll try to implement it.

    There is an easy workaround for multiple custom fields as arguments: use an additional custom field (the one you pass as an argument) where you put a list of the actual custom fields. Then the enzyme can access any of them by the get_post_meta() function.

    The WordPress search facility does not parse out enzymes. Do you think it’s a problem?

  9. Can Enzymes check if a custom field is empty, and use default content from another post if it is?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.