Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Display Announcements in Your WordPress Blog

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Display Announcements in Your WordPress Blog

Yesterday, we asked our twitter (@wpbeginner) users which plugin would they like to see? Ninja Announcement was one of the plugins that caught our attention. The Ninja Announcements plugin displays small portions of text/images/video on pages and posts in your WordPress blog. These announcements are used to let your visitors know about something special. They can be scheduled so that they are only displayed between specified dates/times (for example when you are running a contest). In this article, we will show you how you can display announcements in your WordPress theme on various locations.

First, you need to install the plugin: Ninja Announcements. (Read our Step by Step Guide to Install a WordPress Plugin for Beginners).

Upon activation, you would need to go under your Settings » Ninja Announcement Tab, where you will see a screen like this.

WP Ninja Announcements Plugin

That is the setting page where you can create announcements. When you click on the Add New Announcement Button, it will take you to a page where you can create your custom announcement.

Add Announcements in WordPress

First you see in the option to ignore dates. If you select that option, that means the announcement will be activated unless you deactivate it manually. If you leave that option unchecked, then you are given the option to pick the Begin Date, and the End date. This is a great option if you are running a special promotion, contest, or a giveaway on your blog. Next option you see is the location. For now, we will leave it as the Default (Header). Then you see a Rich Text Editor, where you can add the text for your announcement. Note, you can add images, and videos as well because this is the same editor that you use for writing your posts. All media in your WordPress gallery will work in this text editor. Once you are done writing your announcement, you can press the Submit button. This will bring you back to the original settings page, where you would need to activate the announcement.

This will display an announcement at the top of your WordPress blog like this:

Ninja Announcement Header Position Preview

This will be added to all pages of your WordPress blog. If you do not like this location, then there is another location to display it (in the sidebar widget). For this, you would need to go back to Settings page of the plugin, and click on Edit link for the announcement. Then you will need change the location from Default (Header) to Sidebar (Widget) like shown in the image below:

Ninja Announcement Sidebar Display Option

After this, you will need to click on your dashboard’s Appearance » Widgets tab and then drag the announcement widget to the sidebar:

Ninja Announcement Sidebar Display Option

There are no settings for that widget, so you will just save the sidebar and refresh the page. Now you will see the announcement where your dynamic sidebar is located.

For advanced users, there is an option to place this announcement at a custom location in your WordPress theme. First, you will have to edit the announcement again, and select the Manual (Function) option. Then, you will need to place the following code in one of your WordPress theme’s file:

<?php if (function_exists('ninja_annc_display')) { ninja_annc_display(2); } ?>  

*Note: The 2 number in the code above is the ID of the announcement. This number will change as the announcement ID changes. You can see the announcement ID when you are editing the announcement.*

Custom Styling the Announcements

Ninja Announcement Plugin comes with its own style file located in the plugin folder. But there is an option to style each announcement differently using your theme’s css file. All you need to do is create a id in your css file ‘ninja_annc_2’ where 2 is the ID of your announcement. Example CSS

#ninja_annc_2{width: 520px; height: 200px; background: #000; color: #fff; font-size: 14px;}

It is highly recommended that you add this in your theme’s style.css file or custom.css file rather than modifying the plugin’s css file (because when you upgrade the plugin, the CSS file will be overwritten wiping out your customizations).

Disabling Plugin Stylesheet

If you read our past article on How WordPress Plugins Affect your Site Load Time, then you must have seen that WordPress plugins can slow your site down with additional HTTP Requests such as adding their own stylesheet. For advanced users, who are adding custom styles for the announcement, you do not need to have an additional HTTP request for a useless stylesheet. First, you would need to copy the codes from their ninja_annc_display.css file and paste it in your style.css file. Then add the following function in your theme’s functions.php file:

add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
function my_deregister_styles() {
wp_deregister_style( 'ninja-annc-css' );

If you have any questions / comments about this plugin, feel free to add it in the comments below.

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Webby says:

    Can it be made so that it can be used with editor status and not need adminstrator status?

  2. richard says:

    i have a bunch of questions:

    1) is there a way to do scrolling announcements?
    2) what if i want to change the background color?
    3) is there a way to do a group of announcements rather than just one??

    • Editorial Staff says:

      You would need to customize the plugin codes to accomplish that. For example to change the color, modify the CSS. To make it float with the scroll, you will have to set position fixed in the css. To group them, you would have to modify the php.

  3. Nicole says:

    Great tut and plugin, only issue I have it strips the line breaks and paragraphs. Anyway is there a way to stop this from happenning as it is rather annoying me, e.g. I want to have a heading with a bit of text below it with a link to more info.


  4. Lucas Degen says:

    And if you use it in combination with
    You can have the announcement close.

  5. Adam W. Warner says:

    I love that after years with WordPress I always learn about useful plugins I’d never heard of before, thanks:)

    I wonder why the plugin author didn’t include a footer placement option? Probably not too many people making announcements in the footer I guess, but you could certainly include an advertisement of some sort, or maybe even a promotion targeted toward readers who actually get to the bottom of a page or post.

    • James Laws says:

      You’re right. We just didn’t think of that as an automatic option. You could still paste the function in your footer and accomplish this but I will definitely look at this for a future update. Glad you like the plugin.

  6. Pete says:

    The backend editor ha the font color in white! and no wysiwyg buttons?

    • James Laws says:

      This sounds like it might be a conflict with another plugin. I can’t seem to reproduce it in any of my installs. You could use Firefox with the Firebug add on to find the offending stylesheet.

    • DJ NightLife says:

      I have the same problem! I think it’s caused by desactivating WYSIWYG editor.

  7. James Laws says:

    Thank you so much for such a thorough write up. We’re really glad you like the plugin enough to cover it and hope to produce many more quality plugins.

    Thanks Again!

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.