To display users with specific ID’s on a page you’ll need to run a WP_User_Query
, either by placing the following code in your functions.php and calling it with a shortcode or adding it to the page template:
//Replace the numbers 1, 2 with the user ID's to return
$args = array(
'include' => array( 1, 2 )
);
// The Query
$user_query = new WP_User_Query( $args );
// User Loop
if ( ! empty( $user_query->results ) ) {
foreach ( $user_query->results as $user ) {
echo '<p>' . $user->display_name . '</p>';
echo get_avatar( $user->ID, 120);
}
} else {
echo 'No users found.';
}
Related Posts:
- How to set and use global variables? Or why not to use them at all
- How exactly do automatic updates work?
- What is in media-template.php, and how does it work?
- Is it possible to disable a function of a parent theme?
- Variables declared in header not available in other includes
- Create Image Uploader for Widget
- WordPress Ajax always returns a 404 error
- Displaying a variable stored in functions.php inside widget
- Custom Meta Field – Youtube embed
- Passing a shortcode attribute to a sub-function
- Insert post without actions/hooks
- Restrict WordPress File Type Uploads by User Type
- How to get all existing post types
- phpMyAdmin displays error when importing database
- Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce
- Function set default image when image not present
- How to get the POST TITLE using the POST ID?
- Importing hard coded custom field into acf field
- Displaying the last post on static homepage
- Using foreach loop breaks
- Add child pages of parent to navbar PHP
- How to remove the cufon script from Dzonia Lite theme [closed]
- WordPress plugin for nicer looking slugs? Have multiple pages named the same but they get different slugs
- Showing a different gallery in a seperate post
- How to put “Read more” link in Custom Excerpt inside p tag?
- $wpdb->update with multiple parameters gives error
- WordPress Shortcodes.. printf is outputting a random number… Can’t figure out WHY?
- Remove metabox from WordPress menu editor page?
- Improve page speed loading using CDN and async or defer attribute
- Ajax request returns ‘Array’. How to output the actual results?
- subdirectory index.php is not working
- Get users that likes the post
- wordpress visual composer change grid builder post link
- My php header() function is not working [closed]
- PHP array to JS array to use in google map
- Form Security: nonce vs. jQuery
- My custom get_the_excerpt() can’t get excerpt by ID
- meaning of (array)function()
- Buddypress update user avatar image via REST
- deactivating an active plugin using if page
- Accessing $post after PHP is executed
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Can a page contain php code?
- Last class on last headline?
- How to Change CSS Colors from Custom Plugin Settings Page
- How to relocate paypal button gateway on checkout page in woocommerce
- Passing the name of selected color from the custom component to `render_callback`
- your php installation be missing the MySQL extension WordPress CPANEL [closed]
- {$key} or $key?
- Admin submenu issue with PHP not detecting two strings as equal
- WordPress mod_rewrite not working on php fpm
- Notice: Trying to get property of non-object
- How do I pull information from one wordpress backend into another? [closed]
- Adding data to custom wordpress database table
- Change Spaces to Dashes?
- How to add videos on my home page slider?
- select a single val though a table in wordpress
- How can I enter on the Thank you page in woocommerce the discount code I assigned to the product category?
- PHP inside echo HTML
- Filter ‘comment_notification_text’ not working
- How do I check if a product is in two categories?
- oceanwp+woo mobile cart sidebar text
- Check if current post in loop is last on current page
- php code for outputting a custom page in my account
- wordpress contact form messages not sending although it saying they were sent successfully with this php code
- Find out div class
- Add a top bar to a wordpress theme without editing the header.php file?
- Using a PHP form, get the page title or any other element in the sent e-mail
- Custom field in PHP file
- How do I fix Undefined variable using $_POST in function?
- Check the database for a postmeta field
- Random code snippet showing up in browser
- How to display dual language menus and headers?
- Help hooking into user_register
- Same Server, Same PHP, One Site Doesn’t Work [closed]
- How to echo a PHP code into WooCommerce variation product?
- How to create a sub-page of sub-page?
- Featured Products not showing up in “Featured” area of homepage
- How to hide the Duplicate taxonomy values in WordPress?
- How can I include tags in wordpress search without a plugin
- Retrieve $_POST data to send to javascript without using localize script
- Search bar for page that searches only particular page IDs
- Trying to display user meta by “name” – not by “ID”
- Redirect homepage /page/1/ to /blog/page/1/
- Auto remove empty values in array
- if conditional in sidebar plugin Password content shortcode
- PHP Call outside class function inside anonymous function
- WordPress White Screen Error
- How to translate the blog date in the Avada theme [closed]
- Can php warnings cause an Internal Server Error?
- Set post to draft if matching word is found in the post
- Warning: filemtime(): stat failed for wp_
- How to transfer session after being redirected to other page
- Keep users logged in Without Remember Me
- How to use js variable to php in wordpress functions.php
- Display total count of products in orders of a specific order status
- Background Tasks in a WP Cronjob?
- How to execute a shortcode within a custom field?
- using custom pages for myaccount in woocommerce
- Putting form result in my database