Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wp-builder
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
wp-builder
Commits
5fe242f0
Commit
5fe242f0
authored
2 years ago
by
Grzegorz Rola
Browse files
Options
Downloads
Patches
Plain Diff
chore(readme): more documentation
parent
234e4617
No related branches found
No related tags found
1 merge request
!31
chore(readme): more documentation
Pipeline
#9307
passed with stages
in 2 minutes and 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+64
-0
64 additions, 0 deletions
README.md
with
64 additions
and
0 deletions
README.md
0 → 100644
+
64
−
0
View file @
5fe242f0
[

](https://gitlab.com/wpdesk/wp-builder/pipelines)
[

](https://gitlab.com/wpdesk/wp-builder/commits/master)
[

](https://packagist.org/packages/wpdesk/wp-builder)
[

](https://packagist.org/packages/wpdesk/wp-builder)
[

](https://packagist.org/packages/wpdesk/wp-builder)
[

](https://packagist.org/packages/wpdesk/wp-builder)
WP Builder
==========
wp-builder defines interfaces and abstracts to create WordPress plugins.
## Requirements
PHP 5.6 or later.
## Installation via Composer
In order to install the bindings via
[
Composer
](
http://getcomposer.org/
)
run the following command:
```
bash
composer require wpdesk/wp-builder
```
## Example usage
Use this code in main WordPress plugin file:
```
php
<?php
class
ContentExtender
implements
\WPDesk\PluginBuilder\Plugin\Hookable
{
public
function
hooks
()
{
add_filter
(
'the_content'
,
[
$this
,
'append_sample_text_to_content'
]
);
}
/**
* @param string $content
* @return string
*/
public
function
append_sample_text_to_content
(
$content
)
{
return
$content
.
' Sample text'
;
}
}
class
ExamplePlugin
extends
\WPDesk\PluginBuilder\Plugin\AbstractPlugin
implements
\WPDesk\PluginBuilder\Plugin\HookableCollection
{
use
\WPDesk\PluginBuilder\Plugin\HookableParent
;
public
function
hooks
()
{
$this
->
add_hookable
(
new
ContentExtender
()
);
$this
->
hooks_on_hookable_objects
();
}
}
$plugin_info
=
new
WPDesk_Plugin_Info
();
$plugin_info
->
set_plugin_name
(
'Example Plugin'
);
$example_plugin
=
new
ExamplePlugin
(
$plugin_info
);
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment