Esempio n. 1
0
/**
 * Shortcode processing.
 * 
 * Called by WP when rendering post on frontend.
 * From here follow these:
 * @see types_render_field() Renders shortcode. Can be used other ways too.
 * @see types_render_field_single() Renders single field. Useful for Repeater.
 * Afterwards wrapping options.
 *  
 * @param type $atts
 * @param type $content
 * @param type $code
 * @return string
 */
function wpcf_shortcode($atts, $content = null, $code = '')
{
    global $wpcf;
    // Switch the post if there is an attribute of 'id' in the shortcode.
    $post_id_atts = new WPV_wpcf_switch_post_from_attr_id($atts);
    if (!is_array($atts)) {
        $wpcf->errors['shortcode_malformed'][] = func_get_args();
        return '';
    }
    $atts = array_merge(array('field' => false, 'usermeta' => false, 'style' => '', 'show_name' => false, 'raw' => false), $atts);
    if ($atts['field']) {
        return types_render_field($atts['field'], $atts, $content, $code);
    }
    if ($atts['usermeta']) {
        return types_render_usermeta($atts['usermeta'], $atts, $content, $code);
    }
    return '';
}
/**
 * Calls view function for specific field type.
 *
 * @param $field_id
 * @param $params
 * @param null $content
 * @param string $code
 *
 * @return string
 *
 * @deprecated Use types_render_usermeta() instead.
 */
function types_render_usermeta_field($field_id, $params, $content = null, $code = '')
{
    return types_render_usermeta($field_id, $params, $content, $code);
}
Esempio n. 3
0
    echo '<h1 class="page-title">Author: ' . get_the_author_meta('first_name') . ' ' . get_the_author_meta('last_name') . '</h1>';
    ?>

<!-- TYPES TIP: using get_avatar function to output author's avatar image -->						
				<div class="user-avatar"><?php 
    echo get_avatar(get_the_author_meta('user_email'), '150');
    ?>
</div>
				
<!-- TYPES TIP: using Types function to custom user fields -->		
				<p><strong>Specialty topics:</strong> <?php 
    echo types_render_usermeta("specialty-topics");
    ?>
<br />
				<strong>Staff role:</strong> <?php 
    echo types_render_usermeta("staff-role");
    ?>
</p>

<!-- TYPES TIP: using the the_author_meta function to output the description of the user -->						
				<p><b>About:</b> <?php 
    the_author_meta('description');
    ?>
</p>
				
				</header><!-- .page-header -->
				
			<hr />

			
<!-- TYPES TIP: Creating a custom query for our author/user to display posts belonging to the "Post" and "Book" post types -->