2
{if related_blog_post_1 != "0"}
                <div class="relatedPosts">
                    <h3>If you enjoyed this post, you may also like:</h3>
                    <ul>
                    {related_entries id="related_blog_post_1"}
                        <li><a href="{title_permalink='about/blog-post'}">{title}</a></li>
                    {/related_entries}
                    {if related_blog_post_2 != "0"}
                    {related_entries id="related_blog_post_2"}
                        <li><a href="{title_permalink='about/blog-post'}">{title}</a></li>
                    {/related_entries}
                    {/if}
                    {if related_blog_post_3 != "0"}
                    {related_entries id="related_blog_post_3"}
                        <li><a href="{title_permalink='about/blog-post'}">{title}</a></li>
                    {/related_entries}
                    {/if}
                    {if related_blog_post_4 != "0"}
                    {related_entries id="related_blog_post_4"}
                        <li><a href="{title_permalink='about/blog-post'}">{title}</a></li>
                    {/related_entries}
                    {/if}
                    {if related_blog_post_5 != "0"}
                    {related_entries id="related_blog_post_5"}
                        <li><a href="{title_permalink='about/blog-post'}">{title}</a></li>
                    {/related_entries}
                    {/if}
                    </ul>
                </div>
{/if}


{if series_blog_post_1 != "0"}
            <div class="seriesPosts">
                <h3>Series Contents:</h3>
                <ul>
                {related_entries id="series_blog_post_1"}
                    <li><a href="{title_permalink='about/blog-post'}">{title}</a></li>
                {/related_entries}
                {if series_blog_post_2 != "0"}
                {related_entries id="series_blog_post_2"}
                    <li><a href="{title_permalink='about/blog-post'}">{title}</a></li>
                {/related_entries}
                {/if}
                {if series_blog_post_3 != "0"}
                {related_entries id="series_blog_post_3"}
                    <li><a href="{title_permalink='about/blog-post'}">{title}</a></li>
                {/related_entries}
                {/if}
                {if series_blog_post_4 != "0"}
                {related_entries id="series_blog_post_4"}
                    <li><a href="{title_permalink='about/blog-post'}">{title}</a></li>
                {/related_entries}
                {/if}
                {if series_blog_post_5 != "0"}
                {related_entries id="series_blog_post_5"}
                    <li><a href="{title_permalink='about/blog-post'}">{title}</a></li>
                {/related_entries}
                {/if}
                </ul>
            </div>
            {/if}

Could some please help me fix this code? Or point me to the right reference for this? This {related_entries} does not work anymore. I have tried to look at 2.11.5 docs but have not found anything that could helped me yet.

2
  • 1
    I suggest you first take a look here: docs.expressionengine.com/v2/add-ons/channel/relationships.html Are these related blogposts made by a relationship field? Are these entries in the same channel? If you look at the examples you'll see you have either a child or a parent related entry. Can you specify your channels etc? Also, you'll need to prefix the related entries like {related_entries}{related_entries:title}{/related_entries} – Jelle Dijkstra Mar 7 '17 at 8:42
  • It appears that EE changed the behaviour of relationships sometime between 2.4 and 2.11 - if you look at the EE 2.4 documentation it includes a description of the {related_entries} tag as a thing (agentdir.com/modules/channel/relationships.html). By 2.11 this has disappeared, and relationships have become more general - so rather than using {related_entries id="name_of_relationship_field"} at the start and end of the tag, you simply use {name_of_relationship_field}. HTH – JCOGS Design Mar 7 '17 at 10:00
1

Thanks guys.

The reason is because from version 2.6.0 I believe EE changed the relationship field to relationships. So all I had to do was to change these fields to the new compatible field.

Plus, the syntax also changed a little bit:

Ex:

before:

  {related_entries id="series_blog_post_1"}
      <li><a href="{title_permalink='about/blog-post'}">{title}</a></li>
  {/related_entries}

after:

 {related_blog_post_1}
     <li><a href="{related_blog_post_1:title_permalink='about/blog-post'}">{related_blog_post_1:title}</a></li>
 {/related_blog_post_1}

The good thing is now I can do multiple relations. So instead of creating 5 related blog post fields, I can just create one and select as many related blog posts as I want.

Your Answer

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

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