Download the PHP package moxie-lean/wp-widgets without Composer

On this page you can find all versions of the php package moxie-lean/wp-widgets. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-widgets

WP Widgets

Control the WP widgets whilst using WP in as a headless CMS. Now widgets will output JSON data via an API rather than

Getting Started

The easiest way to install this package is by using composer from your terminal:

Or by adding the following lines on your composer.json file

This will download the files from the packagist site and set you up with the latest version located on master branch of the repository.

After that you can include the autoload.php file in order to be able to autoload the class during the object creation.

Usage

You first need to register the widgets you want to use using the function. This function takes the following parameter:

Where 'lean' is the list of pre-defined widgets you want to use, and 'custom' is a list of any custom widgets you want to add for this project. For example:

Note that Lean widgets can be registered with their short class name, whereas custom widgets need a fully qualified namespace.

All custom widget objects must extend the class. See below.

You can register widget areas using the usual WordPress function:

Creating Custom Widgets

All custom widgets must extend the class. The simplest widget you can create just needs to implement the function, eg:

By default it will use the widget's class name as the widget slug, converting it into dash format (e.g. MyWidget becomes my-widget). If you want to override the slug you can pass it as a third argument into the function.

In addition there are a couple of other functions which you may want to use:

Post Registration

The post registration function runs just after the widget is registered. You can use this to register ACF fields, e.g.:

Get Data

This function returns the widget's data for use in an API. By default it will return the widget's title and all ACF fields. You can override it like this:

Widget

By default the widget will output an error message if you try to use it in a normal WordPress theme. If, however, you want to allow it to be used as a normal widget too, you can override the function:


All versions of wp-widgets with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4 || 8.0
moxie-lean/wp-acf Version 1.*.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package moxie-lean/wp-widgets contains the following files

Loading the files please wait ....