0

Basically im looking to show alternate images depending on the category id. Below I have shown my code, which doesnt work, but I would appreciate any information that any one could give me please! Some additional info about the categories can be seen in the screen shot. Also I have the channel:categories inside a channel:entries loop, the channel is grouped with the category. enter image description here

--

{exp:channel:categories style="linear"}

                                        {if cat_id =="70"}
                                        <figure>

                                                <a href="#">
                                                {if logo}

                                                    <img src="{logo}" class="logo" alt="{title}" />
                                                    {/if}
                                                </a>
                                            </figure>

                                        {if:else}

                                        //do something else

                                    {/exp:channel:categories}

1 Answer 1

3

This is what you will need to do.

                                   {exp:channel:categories style="linear"}

                                        {if "{category_id}" == "70"}
                                            <figure>
                                                <a href="#">
                                                {if logo}
                                                    <img src="{logo}" class="logo" alt="{title}" />
                                                /if}
                                                </a>
                                            </figure>
                                        {if:else}

                                        //do something else

                                        {/if}

                                    {/exp:channel:categories}
2
  • nah dude, didnt work this time. I added a new image into the original comment to show u that its display the if:else each, even though the items have the cat_id of 70. The group id is "1" if that helps. Thanks for the help pal anyways, was appreciated as always :)
    – Sam Crowe
    Mar 30, 2014 at 1:07
  • thanks for your help! {exp:channel:categories style="linear"} {if "{category_id}" != "70"} - this code worked to resolve the issue cheers dude!
    – Sam Crowe
    Mar 30, 2014 at 1:21

Your Answer

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

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