Skip to content

Commit

Permalink
Initial Plugin Code Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
goncaloasimoes committed Jul 27, 2021
1 parent bc9e7d7 commit 647fb8c
Show file tree
Hide file tree
Showing 18 changed files with 3,263 additions and 16 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
indent_size = 4
indent_style = space
trim_trailing_whitespace = false

[*.php]
indent_size = 4
indent_style = tab
75 changes: 59 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,66 @@
# ignore everything in the root except the "wp-content" directory.
!wp-content/
# Dependencies #
################
vendor/
node_modules/

# ignore everything in the "wp-content" directory, except:
# "mu-plugins", "plugins", "themes" directory
wp-content/*
!wp-content/mu-plugins/
!wp-content/plugins/
!wp-content/themes/
# Build directories #
#####################
.sass-cache

# ignore these plugins
wp-content/plugins/hello.php
# IDEs #
########
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
.idea/
.idea_modules/
*.ipr
*.iws
*.iml
atlassian-ide-plugin.xml
com_crashlytics_export_strings.xml
*.sublime-workspace
*.code-workspace
.vscode

# ignore specific themes
wp-content/themes/twenty*/
# VCS #
#######
.svn
.cvs

# ignore node dependency directories
node_modules/
# Packages #
############
*.7z
*.dmg
*.gz
*.bz2
*.iso
*.jar
*.rar
*.tar
*.zip
*.tgz

# ignore log files and databases
# Logs and databases #
######################
/logs
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store
ehthumbs.db
Icon?
Thumbs.db
._*
.AppleDouble
.LSOverride
.Spotlight-V100
.Trashes
*.bak
*.swp
*.orig
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# WP-Plugin

All you need to start creating a plugin for WordPress.

We aim to deliver a focus on the API features of WordPress and it's eventual use as a headless CMS, but feel free to use this base for any kind of plugin. It provides several features that will enable you to develop and test your code.

## Getting started

### Find and Replace

This project is a skeleton, so it has a bunch of keys that need to be replaced with values specific to your project.

For these changes, you should use the "Find and Replace" feature of your editor. Later there will be more options to this. Below you can find the table with the keys and their respective description, along with an example for the possible value.

| Key | Description | Example value |
| ------------------------ | ------------------------------------------------------------------- | ------------------------------------- |
| `26b` | Your username or company name: no spaces | `26B` |
| `unbabble` | See ["Planning Your Plugin – Pick a good name"][1] ([more info][2]) | `Foo Bar` |
| `A new and simple i18n system for WordPress` | Description for the plugin ([more info][2]) | `A WordPress plugin starter.` |
| `https://github.com/26B/unbabble` | Plugin URL ([more info][2]) | `https://github.com/26B/wp-plugin` |
| `0.0.0` | Version to start the plugin with ([more info][2]) | `1.0.0` |
| `26B` | Author name ([more info][2]) | `Pedro Duarte` |
| `https://26b.io/` | Author URL ([more info][2]) | `https://github.com/xipasduarte` |
| `unbabble` | Text domain ([more info][2]) | `foo-bar` |
| `26b` | Your username, company or project name: lowercase and no spaces | `26b` |
| `unbabble` | Plugin identifier: usually the `unbabble` in dash-case | `foo-bar` |
| `TwentySixB\WP\Plugin\Unbabble` | Desired PHP namespace | `26B\WP\Plugin\FooBar` |
| `TwentySixB\\WP\\Plugin\\Unbabble\\` | [PSR-4 autoload][3] for `TwentySixB\WP\Plugin\Unbabble` | `26B\\WP\\Plugin\\FooBar\\` |
| `TwentySixB\\WP\\Plugin\\Unbabble\\Tests\\` | [PSR-4 autoload][3] for `[namespace_tests]` | `26B\\WP\\Plugin\\FooBar\\Tests\\` |

[1]: https://developer.wordpress.org/plugins/wordpress-org/planning-your-plugin/#2-pick-a-good-name
[2]: https://developer.wordpress.org/plugins/the-basics/header-requirements/
[3]: https://getcomposer.org/doc/04-schema.md#psr-4

For further information on writing WordPress plugins refer to the [official documentation](https://developer.wordpress.org/plugins/).

### Run composer

After all of the changes don't forget to run `composer install` to have the dependencies load and the autoload built. (Without this your plugin will break.)
35 changes: 35 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "26b/unbabble",
"description": "A new and simple i18n system for WordPress",
"type": "wordpress-plugin",
"keywords": [
"wordpress",
"plugin"
],
"homepage": "https://github.com/26B/unbabble",
"license": "GPL-2.0+",
"require": {
"composer/installers": "^1.11",
"dg/composer-cleaner": "^2.2",
"php": ">=7.4"
},
"require-dev": {
"phpunit/phpunit": "^9.5.7",
"10up/wp_mock": "@dev"
},
"authors": [],
"autoload": {
"psr-4": {
"TwentySixB\\WP\\Plugin\\Unbabble\\": "lib/"
}
},
"autoload-dev": {
"psr-4": {
"TwentySixB\\WP\\Plugin\\Unbabble\\Tests\\": "tests/"
}
},
"minimum-stability": "stable",
"config": {
"sort-packages": true
}
}
Loading

0 comments on commit 647fb8c

Please sign in to comment.