I'm trying to display metadata from CPTs created by a user on their profile page. I can technically do it exclusively from a PHP file, but it is hard to work with from a formatting perspective. No amount of front-end css makes it look as good as I could do in Views.
Ultimate Member is my profile page plugin, and they have the admin as the child page's author, so I can't easily use the "posts with the same author as the page" View filter in Toolset. I've spent many, many hours trying to figure this out. There are a few similar threads already on here, but none worked for me.
I can display a View, no problem. It's having it filtered by the user that's the problem. I was thinking the new relationship feature would be the answer. It wasn't. thanks
I'm not familiar with Ultimate Member, but if you can clarify what's involved I should be able to help.
This is the bit I don't follow: " and they have the admin as the child page's author".
With Ultimate Member users have a profile page. Is this a static WordPress page which Ultimate Member populates with content about the user? Is the user id set somewhere (e.g. a URL parameter)?
Or is there a unique URL with the username, e.g. site.com/dashboard/john-smith, and that's what you mean by child page?
I need to know how we identify the user to recommend how to set up the Views filter.
I'd say...it is both actually. UM's profile page is a static page (of your choice), where child pages are then created for each new user. You plug in the profile shortcode, and that's that. I'm 99 percent sure it is still tied to the user ID. But, I'm listed as the child page's author, not the user. So I am unable to use the Toolset author View filter by page/post author. Because everyone's profile would just display my posts, and no one would enjoy that.
But yes, they have unique IDs, for example, http://www.wp-types.com/user/nigel with hidden link being the page and /nigel being the chid page.
Below are a couple of snippets from their single-post.php and post.php files, which might help answer your questions.
<?php while ($ultimatemember->shortcodes->loop->have_posts()) { $ultimatemember->shortcodes->loop->the_post(); $post_id = get_the_ID(); ?>
If each user has their own static page and they are the author of that page then you could insert a View on that page and use the "posts with the same author as the page" filter.
But you surely wouldn't want to edit each page and insert a View on it.
I'd suggest you create a Content Template for these pages and insert your View into that template, where, again, you should be able to use that filter, but assigning the template to all of those pages but not other pages on your site may be cumbersome.
I think it would help if I could see if myself, if that's okay?
I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site, even though I don't intend to make any changes.