1

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.

3
  • You'll have to ask Elementor's support team about this. Third-party plugin support is off topic here.
    – Pat J
    Commented 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. Commented May 30, 2023 at 19:17
  • Hi @AndreiDombrov, do you have any updates regarding your request ? I am facing the same need but I can't find a solution. Thanks in advance. Commented Sep 14 at 20:20

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());
});
1
  • This is because this query filter only allows modifying the existing query. There is no source for a "user" query of the query types offered, so the query id can only be used to override one of the chosen existing query types, ie there is no "role__in" for Posts, that is part of the User schema. You'd have to write a new control class accounting for the different schema and handle the scripting of both back end editor controls and front end render. AI isn't likely going to help because E Pro is not public, you'd have to train it first. Commented Jun 13 at 14:44

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.