Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Best way to override a evaluate method from Page class

Started by Muut Archive 9 years ago · 0 replies · 369 views
9 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 1282 9 years ago
Archive · by Muut Archive, 9 years ago
2 889 9 years ago
Archive · by Muut Archive, 9 years ago
2 4019 9 years ago
Archive · by Muut Archive, 9 years ago
1 2894 9 years ago
Archive · by Muut Archive, 9 years ago
3 1078 9 years ago