Is there an easier way to count the related posts than running a query to get the relationship then looping through all of the related posts? We want to do this in a few places, and we're concerned about the performance of running a query every time we want to count the posts.
For context, this would be used in a scenario similar to the following:
[Relationship is Listings to Offers, both CPTs]
Listing Archive Page:
Listing 1
- Name
- Price
- Location
- Number of Offers (Relationship)
Listing 2
- Name
- Price
- Location
- Number of Offers (Relationship)
Listing 3
- Name
- Price
- Location
- Number of Offers (Relationship)