How to avoid one code multiple times instead do that through some function? Shortcode, but I think shortcode is not used in main theme’s core files?

You can use PHP’s includes like this: include dirname(__FILE__).’/components/authorSocials.php’; but you should remember about providing the data to your component. Since the idea is that you will you use it in different places, not always the default values will be available and will be the right ones, so you should add some more code to … Read more

How to make url variable?

Assuming the user’s mobile number is saved in wp_usermeta with meta_key being mobile_number, then adding this to a template will show the current user’s mobile number: <?php echo get_user_meta( get_current_user_id(), ‘mobile_number’, true ); ?>

get_users when from meta key that has serialized values

I’m assuming that the meta_value has a serialized array, not the meta_key (For it would make no sense to have the meta_key to be a serialized array) You really should save the values in seperate fields to be able to query it by wordpress internal functions like get_users. If you definitely have to preserve this … Read more

Creating a custom register form

Ok, I found the solution. I placed the ‘wp_insert_user’ in a variable. And I used that variable to define the extra fields with ‘update_user_meta’. // If successful, register user $user_id = wp_insert_user($fields); update_user_meta( $user_id, ‘teste’, $fields[‘teste’] );

Get meta_query value by user meta array

This should be better for what you’re looking for, the only issue might be how the meta gets returned, as an actual array, or as a string that needs to be turned into an array. $args = array( ‘post_type’ => ‘pictures’, ‘orderby’ => ‘post_modified’, ‘order’ => ‘DESC’ // post_status is unnecessary because default is ‘publish’ … Read more