Hi. I’m trying to set up an approach where a statement will appear in the sidebar of a single-entry page when the entry has a checkbox field checked on the Publish page in the control panel. Here is an example of such a single-entry page on the site in question.
Specifically, I want to be able to specify within the control panel that a particular entry is available for syndication and then show a statement to that effect within the sidebar of that entry’s page.
I have set up the custom channel field with a field type of Checkboxes, text formatting of None and a single Multi-Select Option of Yes.
I’m then trying to put the appropriate code within the sidebar (which is a separate template embedded in the single-entry template - so I can’t put the code within the main channel entries tag that calls the article’s content).
I thought something like this would work:
{exp:channel:entries url_title="{segment_3}"}
{available_for_syndication}
{if item != ""}
This article is available for syndication
{/if}
{/available_for_syndication}
{/exp:channel:entries}It’s working on the single-entry page - displaying or not displaying the “This article is available for syndication” line depending on whether or not the checkbox is checked. The problem is that the statement is also showing up on every non single-entry page.
For the moment, I’ve removed the code so it’s not functioning at all right now.
Any thoughts on ways to fine-tune the code so that the statement doesn’t show up on non single-entry pages? I’ve given some brief thought about ways I might add parameters to the conditional statement so that it would only apply if it was a single-entry page - something based on the segments perhaps - but my first thought (of adding a conditional that segment 3 is not equal to “”) won’t work because there are other pages with a third segment.
I have a feeling that I might be missing something obvious, but ....
Thanks in advance for any help anyone can offer - I really appreciate it.
Frank