Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Best way to override a evaluate method from Page class

Started by Muut Archive 10 years ago · 0 replies · 492 views
10 years ago

I was following this question https://getgrav.org/forum#!/general:group-blog-items-by-year- and I've made some tests (I'm newbie with Grav).

After some tests I got the approach working using '@taxonomy.category': with an array of categories as items.
I have several posts on different categories (subdirectories) and I'm showing all those posts on blog page. To achieve that behavior I've changed line 2520 on class Grav\Common\Page\Page from:

PHP
$results = $taxonomy_map->findTaxonomy($params)->published();

to

PHP
$results = $taxonomy_map->findTaxonomy($params, 'or')->published();

So, my questions are:

1) Has this approach sense?
2) Which is the right way to override a method without changing the core code?

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 2570 9 years ago
Archive · by Muut Archive, 9 years ago
2 1692 9 years ago
Archive · by Muut Archive, 9 years ago
2 4985 9 years ago
Archive · by Muut Archive, 9 years ago
1 3810 9 years ago
Archive · by Muut Archive, 9 years ago
3 1801 9 years ago