numPosts(); // returns integer * numPosts = $page->numPosts(true); // returns string like "5 posts" * ~~~~~ * */ $wire->addHook('Page(template=categoria)::numPosts', function($event) { $page = $event->object; if($page->template != 'categoria') return; $numPosts = $event->pages->count("template=publicacion, categorias=$page"); if($event->arguments(0) === true) { $numPosts = sprintf(_n('%d post', '%d posts', $numPosts), $numPosts); } $event->return = $numPosts; }); $wire->addHook('Page(template=etiqueta)::numPosts', function($event) { $page = $event->object; if($page->template != 'etiqueta') return; $numPosts = $event->pages->count("template=publicacion, etiquetas=$page"); if($event->arguments(0) === true) { $numPosts = sprintf(_n('%d post', '%d posts', $numPosts), $numPosts); } $event->return = $numPosts; });