Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/93digital/terra
A dynamic filtering and pagination framework for WordPress archive pages.
https://github.com/93digital/terra
javascript php wordpress
Last synced: about 2 months ago
JSON representation
A dynamic filtering and pagination framework for WordPress archive pages.
- Host: GitHub
- URL: https://github.com/93digital/terra
- Owner: 93digital
- License: mit
- Created: 2021-07-29T13:38:46.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-14T15:16:55.000Z (over 2 years ago)
- Last Synced: 2024-09-12T21:09:02.574Z (5 months ago)
- Topics: javascript, php, wordpress
- Language: PHP
- Homepage: https://93digital.co.uk/
- Size: 505 KB
- Stars: 0
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Terra
***v1.0.1***
Terra is a rewrite of the 93digital [Lama](https://93digital.gitlab.io/lama/) utility class. The class implements _dynamic filtering_ functionality in WordPress and allows users to quickly filter index/archive pages for custom post types using taxonomies and other custom filters.
**NOTE**: php >= 7.2 is required, earlier versions are not supported.
## Installation
### Composer
From your theme root, run the following command in your terminal to install Terra with [Composer](https://getcomposer.org/)
```bash
$ composer require 93devs/terra:dev-master
```Then, in your `functions.php` add the following:
```php
$GLOBALS['terra'] = new \Nine3\Terra();
```If you have used Lama for the project you're working on you will need to remove it and any initialisations for it, namely `\Nine3\Lama::init();` as the two tools cannot work side by side.
### Luna
Current Luna theme has Terra instantiated by default so you don't need to do anything. If you need to add Terra hooks, the place to do that is: `/inc/hooks/class-luna-terra-hooks.php`
If you're using an older version of Luna which doesn't have Terra baked in you will need to create a new class file in `/inc`, (this is where you will also add any Terra actions or filters) eg:
```php
class Luna_Terra {
public function __construct() {
$GLOBALS['terra'] = new \Nine3\Terra();
}
}
```Then just instantiate the class in `/inc/class-luna.php` like so: `$this->terra = new Luna_Terra();`
## Development
[npm](https://www.npmjs.com/) is needed to compile the JS file.
```bash
npm install
```### Build the JS
```bash
npm run build
```## Debug
When [debugging is enabled](https://codex.wordpress.org/Debugging_in_WordPress) in WordPress Terra automatically outputs in the `debug.log` file, the following information:
- the [\$args](docs/HOOKS-FILTERS.md#5) array parameters passed to the WP_Query (when performing the ajax request)
- the [template](docs/USAGE.md#3) that is trying to load for each element foundAlternatively it's possible to set the constant `TERRA_DEBUG` to `true` to output that information inside the `wp-content/terra.log` file, add the following line to your starter theme/plugin:
```php
define( 'TERRA_DEBUG', true );
```