suntrop Posted July 19, 2017 Share Posted July 19, 2017 Hi all All I could find was the opposite of what I need, how to unpublish a page via API. But I need to publish 500 pages. Those pages are children of/inside a PageTable field … don't know if this matters. Anyhow, I tried to loop through the child pages and publish them. But even one doesn't work … it just stays unpublished // Pagae 2603 is my page with 500 unpublished children if ($page->id == 2603) { $fcp = $page->children('status=unpublished')->first(); $fcp->removeStatus(Page::statusUnpublished); $fcp->save; // foreach ($page->children as $c) { // … // } } There is no such method like publishPage? Link to comment Share on other sites More sharing options...
Zeka Posted July 19, 2017 Share Posted July 19, 2017 $c->of(true); $c->status([]); $c->save(); or https://processwire.com/api/ref/page/remove-status/ 1 Link to comment Share on other sites More sharing options...
szabesz Posted July 19, 2017 Share Posted July 19, 2017 One might also find it helpful for batch changing pages and more. @adrian's great helper tool, the Admin Actions module: 3 Link to comment Share on other sites More sharing options...
suntrop Posted July 20, 2017 Author Share Posted July 20, 2017 Thanks guys! I used Batcher before, but I really have to have a closer look at Adrian's module. 1 Link to comment Share on other sites More sharing options...
adrian Posted July 21, 2017 Share Posted July 21, 2017 You could also use Batch Child Editor's edit mode to change the status of all 500 children at once. Simply click the checkbox for the "Unpublished" label and that will uncheck it for all child pages. 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now