So you’re just looking for a simple shortcode that will call an existing function?
The following will create the shortcode you’re looking for, but admittedly I haven’t tested it with the Cimy User Extra Fields plugin. Add this to functions.php
and try it out:
function shortcode_cimyFieldValue( $atts ) {
global $current_user;
$user_id = ( is_user_logged_in() ? $current_user->ID : NULL );
/*
* First, check to make sure the get_cimyFieldValue() function
* exists. This way, if the plugin is not installed the site
* doesn't blow up...
*/
if( function_exists( 'get_cimyFieldValue' ) ) {
// Grab the shortcode parameters
extract( shortcode_atts( array(
'user' => $user_id,
'field' => '',
'value' => ''
), $atts ));
/*
* Call the get_cimyFieldValue() function using any of the
* user-entered parameters
*/
if( $user_id != NULL ) {
return get_cimyFieldValue( $user, $field, $value );
}
}
}
// Adds the above function as as shortcode
add_shortcode( 'my_cimy_field', 'shortcode_cimyFieldValue' );
This should allow you to call the shortcode [my_cimy_field]
in either of the following ways:
[my_cimy_field field="my_field_name"]
or
[my_cimy_field field="my_field_name" value="Sample Field Value"]