• Resolved addisonmarketingsolutions

    (@addisonmarketingsolutions)


    For instance, when using Elementor’s dynamic field to choose author meta, it asks for a meta key — in this instance we input “autodescription-user-settings” but the widget does not display the values associated with the meta key. How can the values be displayed?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi, I do not think autodescription-user-settings is index of user metadata, I do not think this could be output as is. Consider using WP Data Access to browse and identify various metadata TSF and other plugins store. This should help you to get the meta key you are looking for.

    As always, be careful and make a backup!
    Cheers,
    Pierre

    Thread Starter addisonmarketingsolutions

    (@addisonmarketingsolutions)

    Thanks. I was already using that plugin which is how I identified that autodescription-user-settings contained the values I needed. I just don’t know the syntax to actually get those values displayed. The values in that meta key are a:2:{s:13:"facebook_page";s:44:"URL";s:12:"twitter_page";s:12:"@username";}.

    Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    TSF stores user-meta as an array, which WordPress’s User Meta API converts to a serialized string before saving. Only when obtained via WordPress’s (User-)Meta-API you can obtain the unserialized (and filtered) array-version thereof directly and securely. Heed that last word. The array must then be walked to obtain your desired value, which I don’t think Elementor allows you to do.

    You might be better off doing this programmatically, such as implementing a shortcode.

    For example, the following shortcode outputs a link when a Twitter profile field is set for the current post’s author:

    add_shortcode( 'my_tsf_twitter_author', function() {
    
    	if ( ! function_exists( 'the_seo_framework' ) ) return '';
    
    	// Mind that TSF adds a '@' in front of this, so we need to trim that later.
    	$twitter = the_seo_framework()->get_current_author_option( 'twitter_page' );
    
    	if ( ! $twitter ) return '';
    
    	return sprintf(
    		'<a href="%s" class=twitter-profile>Follow %s</a>',
    		esc_attr( 'https://twitter.com/' . ltrim( $twitter, '@' ) ),
    		esc_html( $twitter )
    	);
    } );

    Transform twitter to facebook in that shortcode, tweak the URL output, and you got yourself a working shortcode for Facebook profiles, too ??

    Thread Starter addisonmarketingsolutions

    (@addisonmarketingsolutions)

    “Array”! Thank you! This is the word I didn’t know to identify what that data was, so that I could properly search for ways to use it. Thank you. The shortcode information is a lifesaver and incredibly, incredibly helpful. Much appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Syntax for meta key values to be used with Elementor dynamic fields?’ is closed to new replies.