<p>This is untested but, give it a try:</p>

<pre><code>{% extends "_layout" %}
{% set title = "Games" %}
{% set entries = craft.entries.section('games').limit(10).order('title') %}
{% block content %}
&lt;ul&gt;
    {% for entry in entries %}
        &lt;li&gt;
            {% for category in entry.GamesGenre %}{{ category.title }}{% endfor %}: &lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt; {% set publishers = entry.GamesPublisher %}{% for publisher in publishers %}({{ publisher.title }}{% endfor %}, {{ entry.GamesReleaseYear.format('Y') }})
        &lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;
{% endblock %}
</code></pre>

<p>If need be, have a look at <a href="https://straightupcraft.com/articles/introduction-to-relations-and-reverse-relations-in-craft-cms-with-examples" rel="nofollow noreferrer">An introduction to relations and reverse relations in Craft CMS, with examples</a></p>

CC BY-SA 3.0
2016-12-18T08:11:24.933Z
Congrats! You won the line length competition against @user1513427
carlcs
CC BY-SA 3.0
2016-12-18T15:25:45.497Z
Yes, works like a charm. You saved my project!
DevServe
CC BY-SA 3.0
2016-12-18T16:59:40.980Z
Not how I would have done it but, when in Rome.
Natetronn
CC BY-SA 3.0
2016-12-19T14:33:42.347Z
@Natetronn, how would you have done it?
DevServe
CC BY-SA 3.0
2016-12-20T19:00:45.910Z
Oh, don't listen to us. Do it how your team (or you) prefers it. That said, I might have added a bit more whitespace (spaces, tabs, newlines etc.) Check out to the docs to better understand [what happens to your whitespace in Twig](http://twig.sensiolabs.org/doc/templates.html#whitespace-control) and how to control it, if need be.
Natetronn
CC BY-SA 3.0
2016-12-18T07:06:28.633Z
2016-12-18T07:06:28.633Z
Natetronn
<p>I have two sections:</p>

<ul>
<li>Games </li>
<li>Publishers</li>
</ul>

<p>Games has a field called "GamesPublisher" that is a relation (field type "Entries"), the Source is "Publishers".</p>

<p>In my template to show an entry from games, I want to display the default field "title" of a publisher that I assigned to the games entry in the admin CP.</p>

<pre><code>{% extends "_layout" %}
{% set title = "Games" %}
{% set entries = craft.entries.section('games').limit(10).order('title') %}
{% block content %}
&lt;ul&gt;
    {% for entry in entries %}
        &lt;li&gt;
            {% for category in entry.GamesGenre %}{{ category.title }}{% endfor %}: &lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt; (***Put Title of Publisher Here***, {{ entry.GamesReleaseYear.format('Y') }})
        &lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;
{% endblock %}
</code></pre>

<p>The place I want to insert the publisher's title is shown as:
<strong><em>Put Title of Publisher Here</em></strong></p>

<p>Thanks all. I just started using Craft about 3 hours ago for the first time!</p>

<templating><sections><category>
Display field from one section in another section
# Display field from one section in another section

(Asked by: username_0 on 2016-12-18)

I have two sections:

Games 
Publishers

Games has a field called "GamesPublisher" that is a relation (field type "Entries"), the Source is "Publishers".
In my template to show an entry from games, I want to display the default field "title" of a publisher that I assigned to the games entry in the admin CP.
{% extends "_layout" %}
{% set title = "Games" %}
{% set entries = craft.entries.section('games').limit(10).order('title') %}
{% block content %}

    {% for entry in entries %}
        
            {% for category in entry.GamesGenre %}{{ category.title }}{% endfor %}: {{ entry.title }} (***Put Title of Publisher Here***, {{ entry.GamesReleaseYear.format('Y') }})
        
    {% endfor %}

{% endblock %}

The place I want to insert the publisher's title is shown as:
Put Title of Publisher Here
Thanks all. I just started using Craft about 3 hours ago for the first time!

**Tags:** templating, sections, category


---

## 1 answers

### Answer by username_1 on 2016-12-18. Score: 1 | Accepted answer

This is untested but, give it a try:
{% extends "_layout" %}
{% set title = "Games" %}
{% set entries = craft.entries.section('games').limit(10).order('title') %}
{% block content %}

    {% for entry in entries %}
        
            {% for category in entry.GamesGenre %}{{ category.title }}{% endfor %}: {{ entry.title }} {% set publishers = entry.GamesPublisher %}{% for publisher in publishers %}({{ publisher.title }}{% endfor %}, {{ entry.GamesReleaseYear.format('Y') }})
        
    {% endfor %}

{% endblock %}

If need be, have a look at An introduction to relations and reverse relations in Craft CMS, with examples

> **Comments:**
> **username_2**: Congrats! You won the line length competition against @user1513427  
> **username_0**: Yes, works like a charm. You saved my project!  
> **username_1**: Not how I would have done it but, when in Rome.  
> **username_0**: @username_1, how would you have done it?  
> **username_1**: Oh, don't listen to us. Do it how your team (or you) prefers it. That said, I might have added a bit more whitespace (spaces, tabs, newlines etc.) Check out to the docs to better understand [what happens to your whitespace in Twig](http://twig.sensiolabs.org/doc/templates.html#whitespace-control) and how to control it, if need be.  

---

