Skip to content

This WordPress plugin provides custom functionality for the creativecommons.org website.

License

Notifications You must be signed in to change notification settings

creativecommons/wp-plugin-creativecommons-website

Repository files navigation

CreativeCommons.org website WordPress plugin

All Contributors

This WordPress plugin provides custom functionality for the creativecommons.org website.

Setup

After cloning the repository, install nodee modules using npm i.

To add a new block

Create a new folder under the src foder. Lets say, the new block called My Block.

  • Create the folder with the name my-block.
  • It should have an index.js file. The file exports the block settings and name. The edit and save methods of block is the content you display in edit and display mode respectively.
  • There should be an edit.js and a save.js in the folder. It can just be a single file if display and edit modes are the same.
  • For any other components, create a components folder under the my-block folder and add more js files inside it.
export const name = 'my-block';

export const settings = {
    title: 'My Block',
    description: 'A brief description of the block',
    category: '<tab>',
    icon: '<icon>',
    edit:Edit,
    save:Save
};
  • Import the file in main index.js and, add an element inside the blocks array.


const blocks = [
    ...otherBlocks,
    MyBlock
];
  • Register the component inside using the following in the wp-plugin-cc-gutenberg-blocks.php file. register_block_type('common/users-list');

There you go, it is a ready to use component.


Running the scripts

Below you will find some information on how to run scripts.

πŸ‘‰ npm start

  • Use to compile and run the block in development mode.
  • Watches for any changes and reports back any errors in your code.

πŸ‘‰ npm run build

  • Use to build production code for your block inside build folder.
  • Runs once and reports back the gzip file sizes of the produced code.

Javascript deploy steps

Since this plugin is to be used as a composer package, this repo needs to include the ReactJS build. So before creating a PR to this repo,

  1. run npm run build and
  2. commit the build folder.

Note, you will need to run npm install in order for the build process to work.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Alberto Trujillo GonzΓ‘lez

πŸ’»

Brylie Christopher Oxley

πŸ“–

David Huertas

🚧

Floyd Mann

πŸ’»

Hugo Solar

πŸ’»

Kriti Godey

πŸ‘€

Shailee Mehta

πŸ’» πŸ“–

This project follows the all-contributors specification. Contributions of any kind welcome!