3

I have a post/posts template wrapped inside a template called blog-posts.html . I would like to have the post/posts template display a different grid column class than how it is displayed when it is wrapped in another template. I think I need to write a conditional. Do I write the conditional in the posts/posts template or blog-posts.html. Below is the code from blog-posts.html:

{exp:channel:entries channel="post" dynamic="no" status="{permissions}" category="13" parse="inward"}
    {embed="post/posts" entry_id="{entry_id}"}
  {if results_none}
    {embed="main/results_none"}
  {/if}
{/exp:channel:entries}
0

First i think your question is better posted on the expressionengine.stackexchange.com site. Generally what you are doing is not the best way to achieve this.

Maybe something like this would be better, because you are not embedding an embed for every result in the channel entries loop:

{exp:channel:entries channel="post" dynamic="no" status="{permissions}" category="13" parse="inward"}
   {if count == "1">
      <div class="your_grid_class">
   {/if}   
   <article>   
      <h2>{title}</h2>
      <p>{body}</p>
    </article>
      {if no_results}
        <div class="your_other_grid_class">
        {embed="main/results_none"}
      {/if}
    {/exp:channel:entries}

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy