<p>From a template you could do:</p>

<pre><code>{% set entries = craft.entries.section('jobs').site('siteA').all() %}
</code></pre>

<p>In your follow up comment, you're passing <code>craft.entries</code> as an element to <code>relatedTo</code>, but that's just going to be an instance of the <code>ElementQuery</code> class.  You need to give it the actual element you're interested in finding the relationship to.</p>

CC BY-SA 3.0
2017-10-17T20:48:27.950Z
Thanks Brad, that's very helpful! I also found another way: 

`{%set entries = craft.entries({ section: 'jobs', siteId: 2}).all() %}`

Downside is, that I need to retrieve id not use handle.
Szczups
CC BY-SA 3.0
2017-10-17T18:04:53.217Z
2017-10-17T18:04:53.217Z
Brad Bell
<p>I have a multisite on Craft 3 and I was wondering how to get section content from another site? Let's say I'm on a default site and I want to get contact content from site with handle siteA?</p>

<p>Can this be done?</p>

CC BY-SA 3.0
2017-10-17T16:33:26.590Z
Of course, just include the siteId in your elementQuery. I'm currently on my smartphone so it's difficult to provide code but it should look like
`$site = Craft::$app->sites->getSiteByHandle('your-handle');` and in your query you include `$elementQuery->siteId = $site->id`
Robin Schambach
CC BY-SA 3.0
2017-10-17T17:15:52.863Z
That's a perfectly good answer - thank you @Anubarak ! I was wondering if this is possible on the frontend using craft.entries.section? I was wondering about this approach: 

craft.entries.section('sectionHandle').relatedTo(...)  - and this is where I'm stuck, because in theory I can pass an array with sourceSite attribute.

When I looked in the source code, there's indeed an option to do that. 

I've a section that's enabled for site with handle "default" and id = 1

I'm querying this like this: 

`craft.entries.section('jobs').relatedTo({ element: craft.entries, sourceSite: 1}); `
Szczups
<templating><craft3>
How to get section content from another site with multisite setting
# How to get section content from another site with multisite setting

(Asked by: username_0 on 2017-10-17)

I have a multisite on Craft 3 and I was wondering how to get section content from another site? Let's say I'm on a default site and I want to get contact content from site with handle siteA?

Can this be done?

**Tags:** templating, craft3

> **Comments:**
> **username_1**: Of course, just include the siteId in your elementQuery. I'm currently on my smartphone so it's difficult to provide code but it should look like `$site = Craft::$app->sites->getSiteByHandle('your-handle');` and in your query you include `$elementQuery->siteId = $site->id`  
> **username_0**: That's a perfectly good answer - thank you @Anubarak ! I was wondering if this is possible on the frontend using craft.entries.section? I was wondering about this approach:   craft.entries.section('sectionHandle').relatedTo(...)  - and this is where I'm stuck, because in theory I can pass an array with sourceSite attribute.  When I looked in the source code, there's indeed an option to do that.   I've a section that's enabled for site with handle "default" and id = 1  I'm querying this like this:   `craft.entries.section('jobs').relatedTo({ element: craft.entries, sourceSite: 1}); `  

---

## 1 answers

### Answer by username_2 on 2017-10-17. Score: 4 | Accepted answer

From a template you could do:
{% set entries = craft.entries.section('jobs').site('siteA').all() %}

In your follow up comment, you're passing craft.entries as an element to relatedTo, but that's just going to be an instance of the ElementQuery class.  You need to give it the actual element you're interested in finding the relationship to.

> **Comments:**
> **username_0**: Thanks Brad, that's very helpful! I also found another way:   `{%set entries = craft.entries({ section: 'jobs', siteId: 2}).all() %}`  Downside is, that I need to retrieve id not use handle.  

---

