Use Single Template only if specific custom field is used

Hi,

I have created a custom single template for a specific type of posts (Book Reviews), and want to conditionally only use it if the following field is not empty in the post:

{{dc:looper:field key="Book.image.url"}}

I’m mainly doing this because I’ve got older posts that need to be updated to be on the same standard as the newer ones, and until I do this, they will look very weird.

I’ve tried using conditional logic like this:

image

But the Single Template is still used for all posts in the “Libros” category.

Hello Kevin,

Thanks for writing in! Regretfully, you cannot use {{dc:looper:field key="Book.image.url"}} dynamic content for the layout assignment condition. It can only be used inside a Looper. I think you should be using post meta instead. I am just not sure what the field name is. I would love to check your site if we can access it. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
– Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

image

Best Regards.

Thanks for the response @ruenel

That’s fine, I’ll work around it by using post meta. I’ll assign a new tag to those posts where I want to use the new Single Layout, and will update other posts as I go :slight_smile:

Thank you!

Hi Kevin,

You are most welcome. Please let us know if you need any further assistance with this.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.