diff options
Diffstat (limited to 'wp-inst/wp-content/smarty-plugins/function.custom_fields.php')
| -rw-r--r-- | wp-inst/wp-content/smarty-plugins/function.custom_fields.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/wp-inst/wp-content/smarty-plugins/function.custom_fields.php b/wp-inst/wp-content/smarty-plugins/function.custom_fields.php new file mode 100644 index 0000000..8c684b7 --- /dev/null +++ b/wp-inst/wp-content/smarty-plugins/function.custom_fields.php @@ -0,0 +1,31 @@ +<?php +/* + * Smarty plugin + * ------------------------------------------------------------- + * File: function.custom_fields.php + * Type: function + * Name: custom_fields + * Purpose: Passes the custom field value to the named function + * ------------------------------------------------------------- + */ +function smarty_function_custom_fields($params, &$smarty) +{ + global $wpblog, $siteurl; + + extract( $params ); + $fields = get_post_custom(); + if( is_array( $fields ) ) + { + while( list( $func, $custom_params ) = each( $fields ) ) + { + $func = str_replace('../', '', $func); + $file = $smarty->plugins_dir . "/custom_fields." . $func . ".php"; + if( is_file( $file ) ) + { + include_once( $file ); + $func( $smarty, $params, $custom_params ); + } + } + } +} +?> |
