I have a view which list a content type order by date. I just want to add a simple condition : the first element of the list must the one with ID = X, even if it was created long time ago. How can i do that ?

  • Maybe add a new field called pinned and set view sorted by pinned field ? Feb 3 '21 at 14:06
  • 1
    Nodes have a field that you could use here: "Sticky at the top of lists"
    – sonfd
    Feb 3 '21 at 15:27
  • @sonfd , missed that , but if there are multiple nodes with sticky field it can not used as sort field Feb 3 '21 at 15:32
  • Yes, that's true, but it's no different than any other field on a content entity.
    – sonfd
    Feb 3 '21 at 15:35
  • For a new field he can set the value as 1 for only that node , which makes it unique and can be used for sorting ? Feb 3 '21 at 16:04

Add two sort criteria, the first one on that ID and the second on the date.

Please note that the "ID" must have the same value for all other nodes except the first to make this works.

So probably it will be necessary to use an extra field - boolean, or integer, depending how many nodes you want to fine control.

If you don't have a lot of content to order in that view you otherwise may consider Entityqueue or DraggableViews.

  • Yes i add a new boolean field and made 2 order by. Simple !
    – lchabrand
    Feb 4 '21 at 15:02

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.