akumawteam/skypress

0.3.2 2023-04-24 19:39 UTC

This package is auto-updated.

Last update: 2024-10-24 23:20:31 UTC


README

Getting started

composer require akumawteam/skypress

Use a plugin

<?php

/*
Plugin Name: Example Skypress
Description: Example Skypress
Author: Thomas Deneulin
Domain Path: /languages/
*/

if (!defined('ABSPATH')) {
    exit;
}

require_once __DIR__ . '/vendor/autoload.php';

use Skypress\Core\Kernel;

Kernel::execute('plugin', ['file' => __FILE__, 'slug' => 'example-skypress'], [
    'custom-post-type' => true,
]);

Add a custom post type

Create a folder mu-plugins/skypress/custom-post-types/ folder.

Create a ".json" file that you call as you wish (eg. movie.json => mu-plugins/skypress/custom-post-types/movie.json ) :

{
    "key" : "movies",
    "params" : {
        "public"             : true,
        "publicly_queryable" : true,
        "show_ui"            : true,
        "show_in_menu"       : true,
        "query_var"          : true,
        "labels" : {
            "name": "Movie"
        },
        "supports" : [
            "title", "editor","author"
        ]
    }
}

Add a taxonomy

You need to activate the Taxonomy module to be loaded by the kernel :

Kernel::execute('plugin', ['file' => __FILE__, 'slug' => 'example-skypress'], [
    'taxonomy' => true,
]);

Create a folder mu-plugins/skypress/taxonomies/ folder.

Create a ".json" file that you call as you wish (eg. countries.json => mu-plugins/skypress/taxonomies/countries.json ) :

{
    "key" : "countries",
      "params": {
        "public": true,
        "publicly_queryable" :true,
        "hierarchical" : true
    },
    "post_types" : ["post"]
}

Add a menu

You need to activate the Menu module to be loaded by the kernel :

Kernel::execute('plugin', ['file' => __FILE__, 'slug' => 'example-skypress'], [
    'menu' => true,
]);

Create a folder mu-plugins/skypress/menus/ folder.

Create a ".json" file that you call as you wish (eg. header.json => mu-plugins/skypress/menus/header.json ) :

{
    "location" : "header",
    "description" : "Header"
}