1

I'm trying to work out if the following is possible in Craft.

Assuming I have a single entry, I want to theoretically tag it as a 'blog' and 'about', both of which are sections I want to then have that entry displayed within both the blog, and the about sections.

From what I can tell an entry is constrained to it's parent section. But is this possible using tags or something similar?

Ideally a craft2 answer, as the site is being developed in craft 2, with the plan to upgrade to craft3 in the summer.

Thanks!

Tim

UPDATE

I feel like I need to describe the problem more, with an example.

Say I have an entry called 'Meet the team', and two sections 'England' and 'U.S.A', the country sections act like normal structure sections - but the Staff Team entry is applicable to both sections.

Is it possible when displaying the England entries to display the Staff Team entry in addition to the USA entries to display the Staff Team entry?

The site in development is planning on having many of these types of pages - so a hard-coded solution to 'get' the post isn't possible.

Another way of describing it is the Wordpress way, of having 1 page in multiple categories, so each category shows that page.

7
  • Ideally a Craft 3 answer because your site is going to break as soon as you update it and you'll have the same issue again.. Just as a side note... There are some hacks to make this possible but there is no clean solution for this. Just so make sure: you want to display the entry in your cp in multiple sections and not in your frontend? because it's trivial there Feb 22, 2018 at 16:26
  • @RobinSchambach - I'm not too bothered about backend, the main purpose is frontend. i.e. a user can get to the single entry through both a blog section and about section. Appreciate the comments on Craft 3. I imagine that the answer will be fairly core dependent, so applicable to both?
    – Tim Coysh
    Feb 22, 2018 at 22:41
  • Craft 2 was build with the yii framework, Craft 3 was build with Yii2 and there is a really huge difference. That's why every single plugin has to be rewritten from the beginning because every plugin is going to break. Every core mechanic is going to break too. So nearly all cp changes you want to do from within a plugin is totally different between Craft 2 and Craft 3. I compared about 80% of their code and not really much remained... Feb 22, 2018 at 23:07
  • @RobinSchambach thanks Robin. I've updated the original question with a better description of the problem.
    – Tim Coysh
    Feb 23, 2018 at 9:59
  • Could you try to use proper Craft words to explain your problem? I assume you don't have the sections England and USA but the section country with the entries England and USA so you would like to relate those two entries with your Meet the team entry... correct? If so you can create a RelationField and relate those two entries with it. I'm still not sure what you mean with "displaying all entries" you can render in your template whatever you like.... {{entry.title}} {%for country in entry.countries %} {{ country.title }} {%endfor%} Feb 23, 2018 at 10:36

1 Answer 1

1

When it's only for frontend: you can search for entries from different sections with

set entries = craft.entries.section(['blog', 'about', 'foo']).find()

This returns you all enabled/active entries from all the sections with the handle blog, about or foo.

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.