Tell us what you are trying to do?
I have two post types : 1) zadanie and 2) dis
"dis" posts contain custom field "artel" with numbers
need to show post "dis" with "artel" field which number equal to number of posts "zadanie" posted by current author.
Example: I posted 10 posts "zadanie"
need to display "dis" post which "artel" field contains number 10.
Please advise how to do this with toolset?
Thank you in advance!
Sincerely
Anton
Hi Anton,
Thank you for contacting us and I'd be happy to assist.
To achieve this, you'll need two views created using the classic/legacy editor:
1. The first view will be set to show the 'zadanie' post type, with the post author query filter, to show only posts where the currently logged-in user is the author.
( example screenshot: post-author-filter.png )
We only need this view to return the number of 'zadanie' posts by the current user, so in the loop of the view, you'll only use the shortcode "wpv-found-count".
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-found-count
To avoid any extra spaces or characters from the view's output, please uncheck the option "Disable the wrapping DIV around the View" and also remove the shortcode "[wpv-filter-meta-html]" from the view's "Output Editor" section.
2. The second view will be set to show the 'dis' post type, with the custom field query filter for the "artel" field, where it is the number equal to the shortcode attribute "artel".
( example screenshot: custom-field-filter.png )
3. When both views are ready, you can use the shortcode of the first view, as the value of the "artel" attribute, in the shortcode of the second view, for example:
[wpv-view name="second-view" artel="[wpv-view name='first-view']"]
Note: Please replace "first-view" and "second-view" with the actual names/slugs of your views.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar