Download the PHP package spock/shadow-taxonomies without Composer

On this page you can find all versions of the php package spock/shadow-taxonomies. 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 shadow-taxonomies

Shadow Taxonomy

Useful for relating Post Types to other Post Types.

Introduction

One of the hardest things to do in WordPress is creating relationships between two different post types. Often times this is accomplished by saving information about the relationships in post meta. However this leads to your code having a number of meta queries, and meta queries are generally one of the poorest, most taxing queries you can make in WordPress.

Metadata can also be a pain to keep synced. For example, when posts are deleted, what happens to the post meta you have saved in on a separate post type?

What is a Shadow Taxonomy.

A shadow taxonomy is a custom WordPress taxonomy which is created to mirror a specific post type. So anytime a post in that post type is created, updated, or deleted, the associated shadow taxonomy term is also created, updated, and deleted.

Additionally by using a taxonomy we get a nice UI of checkboxes for linking posts together for free on the post edit screen.

Installation

Useage

Step One:

Create the Shadow Taxonomy.

Here we are simply creating a normal custom taxonomy. In our example we are creating a taxonomy to mirror a CPT we already have completed called Services. So as a convention I have named my Shadow Taxonomy 'services-tax'.

Also because I am wanting to link Services to another post type called Staff. I have registered this custom taxonomy to show up on the Staff CPT post edit screen.

Lastly, I have not made this taxonomy . That is because I don't want anybody in there messing with the terms for this taxonomy. I want to let the Shadow Taxonomy Library handle creating, updating, and deleting the shadow taxonomy terms. That way I can ensure that my shadow taxonomy stays properly synced to it's associated post type.

Step Two:

Use the Shadow Taxonomy Library API to create an association.

This one line is all you need to create the shadow taxonomy link, so that this library can kick in and take over management of the shadow taxonomy. The first argument is the custom post type name, and the second argument is the newly created shadow taxonomy name.

This line should go immediately after the call in the first step.

Merging both steps using helper:

Use the helper register_shadow_taxonomy to register taxonomy for shadow and establish the relation. (Merging above two steps).

API

get_the_posts is a helper method provided by the library. It makes it easy to fetch the associated posts. Returns an array of WP Post Objects or false if no associated posts are found.

This library also contains a few WP_CLI scripts to help you manage your shadow taxonomies. The primary one is useful when you are using in this library on an existing site, which already contains a lot of posts. The following WP_CLI script will go through and create all the needed shadow taxonomy terms.


All versions of shadow-taxonomies with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
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 spock/shadow-taxonomies contains the following files

Loading the files please wait ....