{"id":31032,"date":"2014-08-09T01:08:48","date_gmt":"2014-08-09T01:08:48","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/notices-api\/"},"modified":"2014-08-09T01:08:48","modified_gmt":"2014-08-09T01:08:48","slug":"notices-api","status":"publish","type":"plugin","link":"https:\/\/bal.wordpress.org\/plugins\/notices-api\/","author":13540733,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0","stable_tag":"trunk","tested":"3.9.40","requires":"3.0","requires_php":"","requires_plugins":"","header_name":"Notices API","header_author":"Daniel Bitzer","header_description":"","assets_banners_color":"","last_updated":"2014-08-09 01:08:48","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"http:\/\/danielbitzer.com\/","rating":5,"author_block_rating":0,"active_installs":10,"downloads":2885,"num_ratings":1,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"1"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1110,11326],"plugin_category":[],"plugin_contributors":[96308],"plugin_business_model":[],"class_list":["post-31032","plugin","type-plugin","status-publish","hentry","plugin_tags-alerts","plugin_tags-notices","plugin_contributors-danielbitzer","plugin_committers-danielbitzer"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/notices-api.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>This is a very simple WordPress plugin for creating frontend notices server side or client side. There are 4 notice types by default <em>success, error, warning, general<\/em> or you can create custom notice types. Server side notices are stored in the session until displayed.<\/p>\n\n<p>This plugin hopes to one day solve the problem of complex WordPress sites with multiple plugins all having their own Notices that all require styling.<\/p>\n\n<p>But for now, the Notices API is useful tool for developers creating custom functionality in their theme.<\/p>\n\n<p><strong>Server Side Usage<\/strong><\/p>\n\n<pre><code>&lt;?php\n    WP_Notices::success( $title, $message, $timer, $priority ); \n    WP_Notices::warning( 'Login Failed', 'You have entered an incorrect Username or password, please try again.'); \n    WP_Notices::error(  $title, $message, $timer, $priority ); \n    WP_Notices::general(  $title, $message, $timer, $priority ); \n    WP_Notices::custom( $type, $title, $message, $timer, $priority );\n?&gt;\n<\/code><\/pre>\n\n<p><strong>Client Side Usage<\/strong><\/p>\n\n<pre><code>jQuery(document).ready(function($){\n\n    $.WP_Notices.success( title,message, scroll_to, timer, callback );\n    $.WP_Notices.error( title, message, scroll_to, timer, callback );\n    $.WP_Notices.general( title, message, scroll_to, timer, callback );\n    $.WP_Notices.warning( title, message, scroll_to, timer, callback );\n\n    \/\/ Custom type\n    $.WP_Notices.render_notice( type, title, message, scroll_to, timer, callback );\n\n    \/\/ Using the callback parameter\n    $.WP_Notices.warning( 'Form Error', 'Invalid form input.', false, 3000, function( $notice ) {\n        console.log( $notice );\n    });\n\n});\n<\/code><\/pre>\n\n<p><strong>Options<\/strong><\/p>\n\n<pre><code>add_filter( 'notice_api_options', 'customize_notice_options' );\n\nfunction customize_notice_options( $options )\n{\n    $options = array(\n        'prepend_selector' =&gt; '#content',\n        'container_class' =&gt; 'notices-container',\n        'before_title' =&gt; '&lt;strong&gt;',\n        'after_title' =&gt; ':&lt;\/strong&gt; ',\n        'scrolling_speed' =&gt; 500,\n    );\n    return $options;\n}\n<\/code><\/pre>\n\n<!--section=installation-->\n<p>This section describes how to install the plugin and get it working.<\/p>\n\n<p>e.g.<\/p>\n\n<ol>\n<li>Upload the plugin directory to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Create some notices in your code!<\/li>\n<\/ol>\n\n<!--section=changelog-->\n<h4>1.0<\/h4>\n\n<ul>\n<li>First version pushed to WordPress plugin repository.<\/li>\n<\/ul>","raw_excerpt":"The simple Notices API currently missing in WordPress.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/31032","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=31032"}],"author":[{"embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/danielbitzer"}],"wp:attachment":[{"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=31032"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=31032"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=31032"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=31032"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=31032"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=31032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}