Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/horttcore/wp-meta-box-contact
https://github.com/horttcore/wp-meta-box-contact
composer meta-box module wordpress
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/horttcore/wp-meta-box-contact
- Owner: Horttcore
- Created: 2019-11-20T09:54:49.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-23T20:08:07.000Z (about 4 years ago)
- Last Synced: 2024-08-20T14:20:59.213Z (4 months ago)
- Topics: composer, meta-box, module, wordpress
- Language: PHP
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WordPress Meta Box Contact data
## Installation
`composer require ralfhortt/wp-meta-box-contact`
## Usage
```php
new MetaBoxContact(
array $screen = [],
string $context = 'advanced',
string $priority = 'default'
)
```### Serviceloader
```php
use RalfHortt\MetaBoxContact\MetaBoxContact;PluginFactory::create()
->addService(MetaBoxContact::class, ['page'], 'advanced', 'default')
->boot();
```### Standalone
```php
use RalfHortt\MetaBoxContact\MetaBoxContact;(new MetaBoxContact(['page'], 'advanced', 'default' ))->register();
```## Fields
- Phone
- Fax
- Mobile
- URL```php
ID, 'contact-phone', TRUE );
$fax = get_post_meta( $post->ID, 'contact-fax', TRUE );
$mobile = get_post_meta( $post->ID, 'contact-mobile', TRUE );
$email = get_post_meta( $post->ID, 'contact-email', TRUE );
$url = get_post_meta( $post->ID, 'contact-url', TRUE );
```## Hooks
### Filter
- `wp-meta-box-contact/identifier` - Change meta box id
- `wp-meta-box-contact/label` - Change meta box label
- `wp-meta-box-contact/phone-{$postType}` - Hide phone field for \$postType
- `wp-meta-box-contact/fax-{$postType}` - Hide fax field for \$postType
- `wp-meta-box-contact/mobile-{$postType}` - Hide mobile field for \$postType
- `wp-meta-box-contact/email-{$postType}` - Hide email field for \$postType
- `wp-meta-box-contact/url-{$postType}` - Hide url field for \$postType#### Example
```php
register();
add_filter('wp-meta-box-contact-url-page', '__return_false');
```## Action
- `wp-meta-contact/before` - Add fields before the phone field
- `wp-meta-contact/after` - Add fields after the url field
- `wp-meta-contact/save` - Save custom fields## Changelog
### v4.1 - 2020-11-23
- Update dependency
### v4.0 - 2020-11-06
- Update dependency
- Added translation### v3.0 - 2020-11-02
- Updated dependency
### v.2.0.0 - 2020-01-15
- Changed: Namespac ed hooks
- Changed: Removed redundant hooks
- Fixed: Broke URL field### v1.0.0 - 2020-01-14
- Initial release