By lWA


2019-05-14 12:40:34 8 Comments

I am looking to create a view for my home page that displays the 3 last added items for 2 different content types (articles and news). Like 2 lists next to each other that also has the option to show more.

enter image description here

I already tried by creating a view with one of the 2 content types but I couldn't seem to manage to show both content types in the same view.

2 comments

@Matt 2019-05-14 19:28:42

If you want two lists, then I'll double Adrian's answer, and say you're going to want two different views. If you select both content types in the same feed, then they'll be interspersed, an order like this: article1 news1 article2

You can add the links by modifying the twig template in your theme.

@lWA 2019-05-14 19:36:23

What Adrian suggested was exactly what I needed. Can't make my upvote shown yet but this was also a good answer!

@lWA 2019-05-14 19:46:33

maybe you can answer the question I commented there?

@Adrian Cid Almaguer 2019-05-14 16:17:28

You can create two views, one for each content type, the configuration is the same, Filter Criteria should be Content Type (select in one articles and in the other news) you should sort by Authored on in DESC order, in the pager select Display a specified number of items (3) and More link (Yes).

Then you can add the two blocks to the page and add the styles with css.

@lWA 2019-05-14 19:35:41

I got the 2 lists made as you suggested and got to show them on the homepage. Now I would like to create some custom css to style them. Already got a custom class on each of the columns but I just don't know where to put the css files...

@Adrian Cid Almaguer 2019-05-14 20:42:06

@iwa in this case search on google how to add css styles in drupal 8

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] Creating a View with Distinct Results

  • 2015-02-19 05:00:08
  • Sage
  • 2100 View
  • 0 Score
  • 1 Answer
  • Tags:   7 views

0 Answered Questions

1 Answered Questions

Create view without content

  • 2018-03-20 11:21:41
  • albert
  • 47 View
  • 0 Score
  • 1 Answer
  • Tags:   7 views

2 Answered Questions

[SOLVED] Creating a view with 2 content of different content types

1 Answered Questions

How to use multiple reverse relationships from different content types in a single View Drupal 7?

  • 2016-05-27 15:25:24
  • Esar-ul-haq Qasmi
  • 67 View
  • 1 Score
  • 1 Answer
  • Tags:   7 views

1 Answered Questions

How to fetch content data based on Node reference field into a view

  • 2016-05-25 10:04:29
  • Esar-ul-haq Qasmi
  • 62 View
  • 1 Score
  • 1 Answer
  • Tags:   7 views nodes

2 Answered Questions

[SOLVED] Views taxonomy for multiple content types

2 Answered Questions

1 Answered Questions

[SOLVED] Pulling in a title from multiple content types

  • 2014-02-12 17:04:28
  • Dan
  • 52 View
  • 0 Score
  • 1 Answer
  • Tags:   7 views

3 Answered Questions

[SOLVED] Show the latest post from multiple content types

  • 2013-02-25 16:07:24
  • jack
  • 1517 View
  • 0 Score
  • 3 Answer
  • Tags:   views nodes

Sponsored Content