Hi,
I have a post type (TV Show) that has a relationship with a post type (Products).
I want some content to appear but only if there is some products linked with a TV show using their relationship.
So I tried using the following conditional formatting but it didn't work, the idea of the below is to check if product name is blank or not, if not blank then shows the content.
[wpv-conditional if="( $(wpcf-product-name).item(@tv-show-product.parent) ne '' )"]Content[/wpv-conditional]
Am I missing something obvious here on how to do this?
The easiest way to do this is with a View, filtered by this post relationship. Depending on where you want it to display, you would choose the other post type as the content for the View. You can leave the wpv-loop section empty. In the wpv-items-found section (but outside of the wpv-loop) you can add the content you want to display if there are related Products. You may need to use the post selection tab to select the other post type here if the information is in the TV show. In the wpv-no-items-found section, you can display something else, or nothing at all.
Ah ok yeah that worked, although when no results I set the view to have no content but its still adding space where the view would be if it was there. Anyway to avoid it adding white space in the content when no results?
First I would check the "disable the wrapping DIV' in the View editor and remove all white spaces and line breaks from the loop and the "no items found" section. Then if that still isn't working as expected I would use the Loop Wizard to recreate the Loop using the "list with separators" option. I'll be glad to take a look if those aren't working.
Hey Christian,
I have tried this but doesn't seem to have made any difference 🙁
Do you want to login and take a look? See if you can see something I have missed.
Sure, where can I test it on the front-end?
Hey Christian
So this page WONT show any products (DVDs in this case) - hidden link
This one will (I am not sure if you really need to see one where the products appear but just in case you do): hidden link
Cheers!
Looks like the login you created for me isn't working any more, can you provide new credentials? I'll take a look in wp-admin.
Okay I ran a quick test by adding some hidden text just before the "product-filtered-list-for-tv-show-page" View in the TV Show Content Template. I don't see any extra space here in the page markup. Am I misunderstanding where the space can be seen?
Ah it is due to some strange padding around the video content above it.
Must have just never noticed it before! Has always been that much of a space.
I understand, that makes sense!