An open API service indexing awesome lists of open source software.

https://github.com/badasswp/display-site-notification-bar

Display a notice bar on your WP home page.
https://github.com/badasswp/display-site-notification-bar

bar notice plugin wordpress

Last synced: 5 months ago
JSON representation

Display a notice bar on your WP home page.

Awesome Lists containing this project

README

          

# display-site-notification-bar

Display a notice bar on your WP home page.

display-site-notification-bar

## Why Display Site Notification Bar?

This plugin makes it super easy to display a notifiction bar on the front-end. It also allows you to customize how the notification bar looks like.

display-site-notification-bar-settings

### Hooks

#### `display_site_notification_bar_admin_fields`

This custom hook (filter) provides a way to filter the admin fields presented on the options page of the plugin.

```php
add_filter( 'display_site_notification_bar_admin_fields', [ $this, 'custom_admin_fields' ] );

public function custom_admin_fields( $fields ): array {
$fields[] = [
'name' => 'name_of_your_control',
'label' => __( 'Control Label', 'your-text-domain' ),
'cb' => [ $this, 'name_of_your_control_callback' ],
'page' => 'display-site-notification-bar',
'section' => 'site_notice_section',
];

return $fields;
}
```

**Parameters**

- fields _`{array}`_ By default this will be an array containing key, value options for the control.

#### `display_site_notification_bar_settings`

This custom hook (filter) provides a way to customise the settings used by the notification bar.

```php
add_filter( 'display_site_notification_bar_settings', [ $this, 'custom_bar_settings' ] );

public function bar_settings( $settings ): array {
$settings['site_notice_text'] = esc_html(
'Lorem ipsum doloar sit amet aquila siento'
);

return $settings;
}
```

**Parameters**

- settings _`{array}`_ By default this will be an associative array containing key, value options of the settings used by the notification bar on the front-end.

## Contribute

Contributions are __welcome__ and will be fully __credited__. To contribute, please fork this repo and raise a PR (Pull Request) against the `master` branch.

### Pre-requisites

You should have the following tools before proceeding to the next steps:

- Composer
- Yarn
- Docker

To enable you start development, please run:

```bash
yarn start
```

This should spin up a local WP env instance for you to work with at:

```bash
http://display-site-notification-bar.localhost:8484
```

You should now have a functioning local WP env to work with. To login to the `wp-admin` backend, please use `admin` for username & `password` for password.

__Awesome!__ - Thanks for being interested in contributing your time and code to this project!