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 this solution:
$user_id = assign_your_user_id_here();
include dirname(__FILE__).'/components/authorSocials.php';
then in your “component” do:
<?php
// Get the id of the post's author.
$author_id = get_the_author_meta('ID', $user_id);
.....
?>
Related Posts:
- How to display some selected user meta data on a specific page with a shortcode?
- Allow shortcode in the author bio textarea
- How to list users by custom field?
- Change user meta value with shortcode
- Parsing a shortcode through an author meta textfield
- SImple Example To Update User Info From Front End [duplicate]
- Adding Author URL to Nav Menu via Shortcode
- How to display content if user meta data isn’t empty with shortcode
- shortcode display metainformation as linked image
- Shortcode for displaying the user’s first name?
- Conditionally Loading JavaScript/CSS for Shortcodes
- Show shortcode without executing it
- How to get a buddypress user profile link and a certain user profile field for the current post author?
- How to create a shortcode with 1 parameter (atts)
- How does a shortcode work?
- Run visual composer code in php page
- Remove wptexturize from a shortcode?
- Using shortcode in Post title
- Audio or playlist shortcode condition according to the amount of files on attachment page
- Does a shortcode with a single attribute have to use an array?
- WP_enqueue_script inside shortcode?
- template_redirect to accompany with a shortcode
- Tinymce shortcodes within shortcode contents
- Post loop created via shortcode not displaying shortcode in content
- Pass shortcode variables to template
- passing multiple parents value into a shortcode
- Is it possible to add a repeater field to TinyMCE’s option window?
- How do I preview the result of a shortcode in the TinyMCE editor?
- Shortcodes: Pros and Cons
- esc_attr not working in shortcode
- Raw output (preventing wpautop)
- Conditionally loading Facebook PHP SDK in shortcode
- Are .MP3 files with capital letter extensions allowed in [audio] shortcode?
- How to handle shortcodes when using the JSON API
- Are shortcode functions applied while rendering the content, or are they executed and stored with the post content?
- is_admin() returns false in save_post hook with Gutenberg editor
- Why are Shortcodes Disabled in Widgets by Default?
- Get Posts shortcode plugin and meta_query?
- possibility to control embedded video timeline with buttons and links external to the player
- Add custom setting that uses radio button to WP Gallery
- Shortcode with hyphen doesn’t work
- WordPress Gallery shortcode: Display one category ID only
- How to get gallery id inserted to a post?
- WordPress Shortcode show database row
- Custom shortcode is not working in text widget
- Shortcodes won’t work on live environment
- Use shortcodes in terms description? [closed]
- Adding to the_content or a variable from within a shortcode function
- Shortcode: text content ends up outside html tags
- How to wp_redirect on ‘init’ hook on condition of current post id?
- Buddypress shortcode for tabs [closed]
- PHP Running On CMS Side of WordPress
- Basic do shortcodes question
- What is this format called (nested shortcodes)?
- Problem with height in video shortcode
- Shortcode not showing $content in correct place
- Best tools for preparing and styling a table [closed]
- When are Shortcode Attributes Available in Template
- How can I insert a shortcode in the title tag of another?
- Shortcode inside text widget do not call enqueue style
- How to create a dropdown of shortcodes in edit mode for posts
- How to execute a shortcode outside the post content/entry in a theme?
- Metabox Keeps Stripping Parts of Shortcode
- Form processing: How to process form before output and access data from shortcode
- How to Retrieve data of Gallery Shortcode and display it above a post
- Checking post content for a shortcode, but content is being returned as empty
- do_shortcode() won’t return PHP Array
- contact form 7 :create shortcode usable in email message [closed]
- Show shortcode only in posts
- Better way to display multiple plugin output on the same page?
- get_queried_object_id / short code returning blank
- Shortcode won’t take into account custom post ID put in parameter
- How to utilise multiple values from a single shortcode attribute?
- JavaScript missing from shortcode content
- shortcode to display specific recent posts
- How to test If a post has a particular term
- wp_link_pages shortcode for ‘nextpagelink’
- Multiple values for one variable
- Function in a wordpress shortcode
- Impossible to display modification in shortcode code?
- Reusable Dynamic Taxonomy Shortcode
- How to display a page dependent on a url parameter supplied by a form/button page?
- How to insert visual compser post grid shortcode in a custom page template? [closed]
- WordPress plugin shortcodes not outputting anything
- WordPress Gallery with ID’s Shortcode not Working
- Featured image with link to post shortcode, image displaying above the post
- Manipulated shortcode output
- Where is escaped the shortcode?
- How to stop unwanted splits in excerpts when using shortcodes for sliders or players
- Changing layout of defaul gallery output to masonry
- shortcode change variable base on user
- Inserting shortcode is blanking excerpt – any ideas?
- Escaping a shortcode so it displays as-is [duplicate]
- If do_shortcode is blank, return some message
- Previous/Next with the same category
- I’ve broken the short code for Contact Form 7!
- echo a shortcode in a shortcode code?
- Applying if (get_post_meta) to new shortcode
- Nested ShortCode works inside the_content, but not outside of it
- 3 shortcodes 2 won’t render [closed]