I’m trying to create an authoring system using the cookbook approach however when I get to the authors.php template, it breaks giving me the error:
“Call to a member function children() on boolean”
So I altered it slightly to not use the find() function but it still isn’t pulling the articles and filtering them by author.
Authors.php
<main class="main m-scene" role="main">
<section class="wrap m-header scene_element scene_element--fadein" >
<?php $authors = page('authors')->children() ?>
<?php $articles = page('archive')->children() ?>
<h1>Authors</h1>
<?php foreach($page->children() as $author): ?>
<article class="author">
<h1><?php echo $author->name()->html() ?></h1>
<ul class="articles">
<?php foreach($articles->filterBy('author', $author->uid()) as $article): ?>
<li><a href="<?php echo $article->url() ?>"><?php echo $article->title() ?></a></li>
<?php endforeach ?>
</ul>
</article>
<?php endforeach ?>
</section>
</main>
Authors.yml
title: Authors
options:
preview: false
status: false
pages:
template: author
fields:
info:
label: About
type: info
text: >
The Authors Page is used to add all of the authors you can then select when creating new article posts. After filling this out and then adding them to a article, they will be added to the contributors section and have their own page with all their articles listed.
Author.yml
title: author
options:
status: false
pages: false
fields:
name:
label: Name
type: text
biography:
label: Biography
type: textarea
email:
label: E-mail
type: text
website:
label: Website
type: text
twitter:
label: Twitter
type: text