sixach/wp-snippets

A plugin containing factory classes or methods for the Sixa projects.

Installs: 10 994

Dependents: 1

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 0

Open Issues: 1

Type:wordpress-plugin

v1.7.3 2022-04-12 15:24 UTC

README

This repository is a collection of useful functions for WordPress projects.

Introduction

At Sixa, we strive to provide a top-notch and solid code base for all WordPress projects. In order to improve both our efficiency and consistency, we need to standardize what we use and how we use it.

This repository allows us to reuse initial functions and classes to make sure all projects can get up and running as quickly as possible while closing adhering to Sixa’s high-quality coding standards.

Installation

composer install sixach/wp-snippets

such that in composer.json you require the package

{
    "require": {
        "sixach/wp-snippets": "^1.4.1"
    }
}

Make sure to use the latest version, the version in the example above might be outdated.

Usage

In the file in which you wish to call a function or factory class from WP Snippets, simply import the class and call it subsequently, e.g.

<?php
namespace Package\Subpackage;

use Sixa_Snippets\Dashboard\Menu_Options as Menu_Options;

class My_Class {

    public function some_cool_function(): void {
        // The class imported from Sixa_Snippets
        new Menu_Options (
            array (
                array (
                    'default'     => 'no',
                    'type'        => 'checkbox',
                    'id'          => 'edit-menu-item-is-button',
                    'name'        => 'is_button',
                    'description' => __( 'Style this item as a CTA button? (Top-level only)', '@@textdomain' ),
                ),
            )
        );
    }
    
}
?>

Documentation

For a more detailed documentation on the functionality included in this package, please refer to the about page of this repository.

Notes

Note 1: Much of the functionality in this repository is intended to be optional depending on the needs of the project. E.g. Breadcrumb class.

Note 2: Presentation should be kept in the theme. Separating functionality from aesthetics makes long-term development, maintenance, and extensibility much easier.