This members-only tutorial provides the steps to define a custom function that returns that number of items of the given Custom Post Type other than the current one when any singular page of the CPT is being viewed that belong to the same taxonomy term(s) as the current item.
This can then be used, for example, with Oxygen's Dynamic Data > PHP Function Return value feature to ensure that a Section having a Repeater for showing "related" CPT items gets output only if there is at least one matching post.
Step 1 - Custom function
Install and activate Code Snippets plugin.
Go to Snippets > Add New.
Title: [Function] Get post count given CPT, taxonomy while excluding current item
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $599 one-time).
Already a member? Log in below or here.