Skip to content

A WordPress plugin to display a notification above your site that uses custom post types.

Notifications You must be signed in to change notification settings

jazzsequence/notifications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notifications

Easy, customizable notifications for your WordPress site

Description

How many times have you needed to display a notice across your site? Too many, if you ask me. I wrote this plugin because many of the notification bar plugins out there leave much to be desired. Either there are too many options or not enough or not the ones that I want. Plus, it's not easy to create a notice -- you have to go to some crazy screen and set options unique to that plugin.

This plugin uses custom post types, so notifications are set up like mini-posts that we all know and love. Multiple controls, as well as a built-in filter, enable developers and casual users alike to easily customize the notification bar to your heart's content.

Update: This plugin now supports the Theme Hook Alliance tha_body_top action. If you are using the body_open action in your child theme, please change this to tha_body_top, e.g.

do_action( 'tha_body_top' );

Usage

Notifications looks for the body_open hook. This hook was first proposed on Trac by Andrew Nacin as a way to hook into an action that fires immediately after the <body> tag in the code.

Want to filter the output to customize how the notification gets displayed? Use the notf_notification_filter filter in your plugin or theme, like this:

     function my_test_filter( $output ) {
     	$output = '<span class="whoops-i-did-it-again" style="color: red;">'.notf_message().'</span>';
     	return $output;
     }
     add_filter( 'notf_notification_filter', 'my_test_filter' );

Important: Use the notf_message function in your filter to return the actual notification.

Installation

Via Composer

Notifications can be installed on Composer-based WordPress sites by using the following command:

composer require jazzsequence/notifications

Via Git Updater

Notifications supports Andy Fragen's Git Updater method of managing plugins.

  1. Download and install Git Updater on your WordPress site.
  2. From the Git Updater admin pages, navigate to Install Plugin and use the following values:

Plugin URI: jazzsequence/notifications
Repository Branch: main
Remote Repository Host: GitHub
GitHub Access Token: (optional, leave blank)

Via WordPress Plugin Repository

The plugin can be installed via the WordPress plugin repository, however, the version in the repository may not be the most current version. Use the standard methods of searching for and installing the plugin from the Plugins page in your WordPress dashboard.

Changelog

1.1.5

  • Installable with Git Updater and update installation notes.

1.1.4

  • Installable with composer install jazzsequence/notifications

1.1.3

  • Checks for messages before trying to output them (thanks Daron Spence!)

1.1.2

  • Updates support for Theme Hook Alliance action hook instead of arbitrary, theme-specific hooks.

1.1.1

  • fixes validation _doing_it_wrong()

1.1

  • added sticky option, to stick the notification to the top of the page, rather than scrolling with the page.

1.0.1

  • removes menu order (can conflict with other post types with same menu order)

1.0

  • first public release

Upgrade Notice

1.1.2

Please update your themes to support the new tha_body_top action!

<?php do_action( 'tha_body_top' ); ?>

About

A WordPress plugin to display a notification above your site that uses custom post types.

Resources

Stars

Watchers

Forks

Packages

No packages published