Coder Social home page Coder Social logo

magic-maker's Introduction

Magic Maker

Table of content

Building WordPress Plugin Archive

Prerequisites

Before you begin, ensure you have met the following requirements:

  • You have installed Docker and added support for Docker Compose commands. Instructions are available here.

  • You have installed GNU Make utility, which is commonly used to automate the build process of software projects. Make is often pre-installed if you're using a Unix-like system (such as Linux or macOS). Run this command to verify the installation: make --version

Make Commands

Build

Ensure that ./bin/wp.sh is executable before using the make build command:

chmod +x ./bin/wp.sh

To build the WordPress plugin archive, run the following command:

make build

This command generates magic-maker.zip, a self-contained archive ready for WordPress installation.

Shortcodes

My Form shortcode

Adds a form to add new things.

Examples:

[my_form]
[my_form title="Add Things"]

Accepted Attributes:

Attribute Description Default
title The title of the form. Magic Maker: Add Things

My List shortcode

Renders a list of things along with a search form.

Examples:

[my_list]
[my_list title="All Things"]
[my_list search-form-title="Search Things"]

Accepted Attributes:

Attribute Description Default
title The title of the form. Magic Maker: All Things
search-form-title The title of the search form. Magic Maker: Search Things

Rest Api

My List and Search Rest Apis

Renders available things along with a pagination data.

Endpoints

Endpoint Description
/things Get all things
/things/page/1 Get the first page of things
/things/search/test Get all things with test in the name
/things/search/test/page/1 Get the first page of things with test in the name

Request

curl --location 'https://wordpress.test/wp-json/magic-maker/v1/things/' \
--header 'X-Wp-Nonce: ${nonce}'

Response

{
    "things": [
        {
            "id": "1",
            "name": "test",
            "created": "2024-05-06 18:44:07"
        },
        {
            "id": "2",
            "name": "testing",
            "created": "2024-05-06 18:44:13"
        },
        {
            "id": "3",
            "name": "test is fun",
            "created": "2024-05-06 18:44:19"
        },
        {
            "id": "4",
            "name": "test is super fun",
            "created": "2024-05-06 18:46:43"
        },
        {
            "id": "5",
            "name": "sample fun",
            "created": "2024-05-06 20:55:23"
        },
        {
            "id": "6",
            "name": "super",
            "created": "2024-05-06 20:56:26"
        },
        {
            "id": "7",
            "name": "another test",
            "created": "2024-05-06 20:59:02"
        },
        {
            "id": "8",
            "name": "another fun",
            "created": "2024-05-06 20:59:07"
        },
        {
            "id": "9",
            "name": "how long is fun.. woow....www.",
            "created": "2024-05-06 21:01:37"
        },
        {
            "id": "10",
            "name": "pagination???",
            "created": "2024-05-06 21:01:52"
        }
    ],
    "pagination": {
        "current_page": 1,
        "per_page": 10,
        "total_pages": 3
    }
}

Add a thing Rest Api

Adds a thing.

Endpoint

Endpoint Description
/things/add Add a thing

Request

curl --location 'https://wordpress.test/wp-json/magic-maker/v1/things/add' \
--header 'X-Wp-Nonce: ${nonce}' \
--form 'name="Super Ninja"'

Response

{
    "thing_id": "11",
    "success": true
}

Note: The nonce and rest api data is available in the magicMaker object via window object. use magicMaker.rest.nonce and magicMaker.rest.url to get the nonce and the rest api url.

License

Magic Maker is free software released under the GNU General Public License version 2 or any later version. Refer to LICENSE for details.

magic-maker's People

Contributors

hasukmistry avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.