This is taken from this previous thread but I still can't get the answer. Can someone help me?

Basically I am looking to be able to display different sidebar options dependant on what option is picked in a custom field.

Channel = page.

Custom Field = page_sidebar_options - which is a select dropdown with 6 options.

Embed Templates = sidebar_default, sidebar_opt_1, sidebar_opt_2 etc.

Template code:

{exp:channel:entries channel="page" disable="member_data" limit="1" dynamic="no"}

The answer given on the EE forums hasn't worked for me. I can get my page to display "sidebar_default", "sidebar_opt_1" etc but not the actual code itself.


1 Answer 1


Give this a shot.

{exp:channel:entries channel="page" ...}
  {if page_sidebar_options == "default"}{embed="include/sidebar_default"}{/if}
  {if page_sidebar_options == "one"}{embed="include/sidebar_opt_1"}{/if}
  {if page_sidebar_options == "two"}{embed="include/sidebar_opt_2"}{/if}
  • Hi Jason,thanks for the response. That seems to work but I had to set dynamic to "yes". You're a star! Thanks. Jan 27, 2013 at 20:22
  • No problem. Just make sure you understand the dynamic parameter though. Yes means it's going to look in the URL for the entry id or the url title. No means you either want to show all entries or you will specify the entry id or url title specifically. Jan 27, 2013 at 20:26
  • Thanks. Is there any way I can get this to work across 5 different channels without doing the above for each channel and adding an extra custom field to each? Thanks again. Jan 27, 2013 at 20:30
  • You'd still have to recreate the field for each channel. But you can reuse the code. Put it in a snippet so you can use it in different templates. Change page_sidebar_options to {channel_short_name}_sidebar_options. Change the channel="pages" to channel="pages|channel2|channel3|etc" Jan 27, 2013 at 20:36
  • Also, if the answer was helpful, would you mind marking it as correct? Jan 27, 2013 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.