Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Brajesh Singh

    (@sbrajesh)

    Hi Gomle,
    Thank you.

    I am sorry but we d o not offer any shortcode. The purpose is to add new field types.

    It is very eachy to fetch the content though.

    You can write a shortcode like this

    
    
    add_shortcode( 'xprofile_field_data', function ( $atts = array(), $content = '' ) {
    	$atts = shortcode_atts( array(
    		'field'   => '',
    		'user_id' => get_current_user_id(),
    	), $atts );
    
    	if ( empty( $atts['field'] ) ) {
    		return '';
    	}
    
    	return xprofile_get_field_data( $atts['field'], $atts['user_id'], 'comma' );
    } );
    
    

    Please put the code in your theme’s functions.php

    and then you may use it like this

    For logged in User

    
    Your Name: [xprofile_field_data field=1]
    

    For any other user

    
    Your Name: [xprofile_field_data field=1 user_id=actual_user_id]
    

    Regards
    Brajesh

    Thread Starter Gomle

    (@gomle)

    Thank you so much. This DID work perfectly well.

    Is there a way I can both print the date as in l, d. F – Y
    and also count the days, months and years as in: 4 years, 2 months and 8 days
    using the profile-field: Date selector, and put it in a short code?

    Example: [shortcode-date] and [shortcode-date-until]

    I am learning each day, so I understand if this is not included in the support.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcodes’ is closed to new replies.