Lama

LAMA (Italian word for BLADE) is a utility class that helps you to quickly implement the Load More & dynamic filtering functionality in WordPress.

NOTE: Php >= 7.2 is required earlier version are not supported.

Installation

Composer

Run the following command in your terminal to install Lama with Composer

$ composer require "93digital/lama @dev"
1

Below is a basic example of getting started with the class, though your setup may be different depending on how you are using composer.

<?php
require __DIR__ . '/vendor/autoload.php';

\Nine3\Lama::init();
1
2
3
4

Install manually

Download/Clone this repository and load the main class file into your theme/plugins like so:

require_once 'lama/class-lama.php';

\Nine3\Lama::init();
1
2
3

Development

npm/yarn is needed to compile the JS file.

npm

npm install
1

yarn

yarn install
1

Build the JS

npm

npm run build
1

yarn

yarn build
1

Debug

When the debug is enabled in WordPress LAMA automatically outputs, in the debug.log file, the following information:

  • the $args array parameters passed to the WP_Query (when performing the ajax request)
  • the template that is trying to load for each element found

In alternative is possible to set the constant LAMA_DEBUG to true to output that information inside the wp-content/lama.log file, add the following line to your starter theme/plugin:

define( 'LAMA_DEBUG', true );
1

Documentation

The class comes with an extensive documentation available here