0

I am trying to create a loop in Elementor's theme builder that will display each user with the role of the Contributor or Author. I.E. When the admin of the website will add a new user with the above role, it will automatically display the newly added user on the About page, and at the same time that user will have access to the website.

This is to avoid duplication of work when the same team members might need to add articles to the website.

Thanks. A possible workaround would be to create a new category (e.g. team-members) in posts and create a post for each member, but then the users will have to be entered separately which is time-consuming and prone to errors/inconsistencies.

2
  • You'll have to ask Elementor's support team about this. Third-party plugin support is off topic here.
    – Pat J
    May 30, 2023 at 18:49
  • I am not trying to get support as such. My question might actually lead to the development of a plugin (if such a one doesn't exist already). All I am asking is if this kind of implementation is possible at all in the WordPress paradigm. May 30, 2023 at 19:17

2 Answers 2

0

I think you could do this with using the dynamic content of Elementor Pro. With the loop grid, there is an option to do a custom query with the query id. From that you would just write. a PHP snippet to do exactly as you are looking for. It may be necessary to also create custom dynamic tags for each element that you want displayed in the loop grid as well. But definitely achievable.

0

I am in dire need of a solution for this. This is the only Support article and only article I can find on creating a Query to populate users within the "Elementor" loop grid. I need to create a filter that will only populate users that match metadata values to appear within the grid of "Elementor". I need users that are the user role: "Student" to populate on the loop grid and to be able to set dynamic tags (which I already have set) for things like the "Username", "Profilepictureone", etc. I have spent countless hours using AI and other tools to try to achieve this functionality, with no success. This is the only support article that I can find. This is the script that I made that is not working ...

add_action( 'elementor/query/{query_id}', function( $query ) {
    // Set your desired roles
    $roles = ['contributor', 'author'];

    // Modify the query to filter users by roles
    $user_query = new WP_User_Query(array(
        'role__in' => $roles,
    ));

    // Ensure the query only includes user IDs from the result
    $query->set('include', $user_query->get_results());
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.