Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jesse Stopple 4 posts 94 karma points
    Jul 06, 2017 @ 13:08
    Jesse Stopple
    0

    Grab content not related to the current page?

    I have the following code working for grabbing and looping multiple content items of a specific document type in a template:

    var selection = CurrentPage.Site().Children("NewsArticle").Where("Visible");
    
    foreach (var item in selection) { etc etc }
    

    What I am trying to accomplish is to grab content from outside the current page. I have created a new document type "RightColumnNews". I want to grab any content of that doc type and loop through the results regardless of what page is currently being viewed.

  • Jesse Stopple 4 posts 94 karma points
    Jul 06, 2017 @ 13:37
    Jesse Stopple
    100

    Here's what got it working

    I had my RightColumnNews items inside a specific content parent. I set the parent target by using the content ID, then looked for children of that ID which contained the specific doc type alias:

    var node = Umbraco.Content(1089);        
    foreach (var item in node.Children("RightColumnNews").Where("Visible")) { etc etc }
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies