• Resolved Rom Soul

    (@rom-soul)


    Hi,

    I’d like to execute a shortcode on the user presentation page, but it has to be in a template file, because the SC dynamically includes the user ID…

    i.e. I’d like shortcode [my_sc id=”12″] for user #12, so I’m looking for the PHP file where I can add a line like :
    do_shortcode('[my_sc id="'.$id.'"]');

    Which file can I modify in my child theme ? Or is there a theme setting that would do the trick ?

    Thanks !

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @rom-soul,

    The [my_sc id=”12″] is not an Ultimate member shortcode, can you please clarify what you are trying to achieve?

    Regards.

    Thread Starter Rom Soul

    (@rom-soul)

    Hi, Thanks for your answer,
    [my_sc] was just an example !

    The SC I need to execute on profile page is [gmw_user_location user_id=”12″]
    It comes from the (excellent) module GeoMyWP User locator, and displays a map.

    I found my way by adding the following lines in functions.php, what I needed was the hook um_profile_content_main_defaultand the function um_profile_id()

    
    add_action('um_profile_content_main_default', 'user_map');
    function user_map( $args ) {
    	$usr_id = um_profile_id();
    	$mapshortcode ='[gmw_user_location user_id="'.$usr_id.'"]';
    	echo do_shortcode($mapshortcode);
    }

    It works fine ! Thanks for this great module !

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to execute shortcode on user page ?’ is closed to new replies.