We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22303 MODX Staff
    • 10,725 Posts
    This actually might be more appropriate for Wayfinder which can be used to target a specific parent and include it in the output. getResources does not currently have an option for including the specified parents...
      • 8489
      • 90 Posts
      Ok thanks!, I will try it with Wayfinder.

        • 8489
        • 90 Posts
        Thanks for mention Wayfinder, got it working now smiley

        On the page:

        [[!Wayfinder?
        &startId=`[[UltimateParent]]`
        &showSubDocCount=`1`
        &rowTpl=`count`
        &limit=`1`
        &level=`1`
        ]]

        Tpl "count":

        <a href="[[+wf.link]]">[[+wf.pagetitle]] ([[getChildCount? &parent=`[[+id]]`]])</a>
          • 8489
          • 90 Posts
          Thanks to Mark H.

          Snippet: callParent

          $parent = $modx->resource->getOne('Parent');
          return $modx->getChunk('countTplRow',$parent->toArray());


          Chunk: countTplRow

          <a href="[[~[[*parent]]]]" title="[[+menutitle]]" class="overzicht"><span>Overzicht alle [[+menutitle]] / Aantal (<strong>[[getChildCount? &parent=`[[+id]]`]]</strong>)</span></a>


          Snippet: getChildCount

          $count = 0;
          $parent = isset($parent) ? (integer) $parent : 0;
          if ($parent > 0) {
              $criteria = array(
                  'parent' => $parent,
                  'deleted' => false,
                  'published' => true,
              );
              $count = $modx->getCount('modResource', $criteria);
          }
          return (string) $count;