News Manager 2.4 documentation

See also: new features and options in version 3.0

News Manager (for GetSimple CMS) an easy to use plugin allowing you to publish posts/articles on your website.

Installation

You can download the latest version from GetSimple Extend. Unzip the downloaded file and copy its contents to your plugins folder. Go to the Plugins tab and make sure the plugin is activated. The required data folder and configuration file should be created automatically when you first access the plugin.

Upgrading

Upgrading from 2.2.x or later: just unzip and upload/copy news_manager.php and news_manager folder (with all its contents) to your plugins folder, overwriting existing files. (You should make a backup first, especially if you had patched it or changed some strings in language files.) - See also: Upgrading from 2.x to 3.x

Usage

To access the plugin, go to the News Manager submenu under the Pages tab. Once you're in the News Manager main admin panel, you will notice three buttons in the top-right corner: Settings, Create New Post and Filter. The Settings button allows you to change the behavior of the News Manager plugin, with the Create New Post button you can start writing new posts and the Filter button lets you search through long lists of posts.

Settings

The settings panel currently has 7 different options, each of which will be explained in more detail in the list below.

  • Page To Display Posts - Select the slug (url) of the page on which you want to display your posts. The original content of this page will be replaced with the posts that you have published.
  • Language used on News Page - This controls the language settings for things like 'Published on', 'Older/Newer Posts', etc on the news page. Note that it won't affect the settings for the admin section of the News Manager plugin, that follows the global setting.
  • Posts On News Page Are Shown As - You can choose for either Full Text or Excerpt. The first option will show each post as is, the second option displays an automatically created excerpt without html formatting for each post.
  • Excerpt Length - This number defines the length in characters of the automatically created excerpts.
  • Number Of Posts On News Page - This controls pagination. Whenever the total number of published posts exceeds the number entered here, a navigation menu will be shown at the bottom of the news page, allowing the user to navigate between pages with posts.
  • Number Of Recent Posts - This plugin comes with a few (optional) sidebar functions, one of which provides a list with titles of the most recent posts. The value entered here controls how many titles are shown at each time.
  • Use Fancy URLs for posts, archives, etc - If you enabled fancy URLs in the global GetSimple settings, you can enable them for the News Manager plugin too. When activated, you will have to update your .htaccess file because otherwise it will not work! If applicable, after you have saved your settings a notification will appear with a link to a page explaining you how to change your .htaccess file.

Writing Posts

Writing posts is more or less similar to writing pages: you can define a Post Title, and write the Post Content just as regular pages. Clicking on the Post Options button in the top-right corner reveals some extra options which are Slug/URL, Tags, Publication date and the ability to make a post Private. A page slug is a user- and SEO-friendly short text used in the post URL. In the Tags field you can enter whatever keywords you see fit, as long as they are single words and seperated by commas. The publication date speaks for itself and making a post private prevents it from being displayed on the front-end part of your website.

Sidebar Functions

A couple of optional sidebar functions are also availabe. They can be found in the file sidebar.php which is located in the /plugins/news_manager/inc/ folder. What follows is a short description of what each function does:

  • nm_list_recent - Shows a list with the titles of the most recent articles, each title links to the full article.
  • nm_list_archives - Creates a list with archives. Archives are ordered by month and each archive contains all posts that have been published in that specific month.
  • nm_list_tags - Shows all unique tags in a tag cloud. Frequently used tags are shown bigger than others.
  • nm_search - Provide a form to search articles based on keywords.


For example, to show a list of recently published articles in the sidebar, simply put the following code in a component (e.g. sidebar) or in your theme template:

<?php nm_list_recent(); ?>

SEO

- See function/template tag nm_post_title (since News Manager 2.3.x) to have a proper <title>

- Recommended:
(update) Since News Manager 3.5:
Edit your template(s) and change get_header to nm_get_header (or get_i18n_header to nm_get_i18n_header if you use mvlcek's *I18N* plugin). This way your posts, archives and tag pages will have proper canonical meta tags.
Before News Manager 3.5:
Change your template's <?php get_header(); ?> to:
<?php get_header(false); ?> - This way your site won't have the canonical meta tag (or else, because of the way GetSimple works, all posts have the same canonical URL, that of the news page)

Languages

There are multiple language files included, they can be found in the /plugins/news_manager/lang/ folder. You can create your own language file by translating any of the existing ones. Please contact me (via the GS forum topic or PM) when you have created a new language file and I will include it in the next release.

CSS

This plugin uses various CSS classes (title, date, content, etc), but you have to write your own CSS rules in order to apply a style of your liking. CSS code for the GetSimple Innovation theme is shown below.



.nm_post {
  padding: 0;
  margin-bottom: 50px;
}

.nm_post h3 {
  margin-bottom: 5px;
}

.nm_post p {
  margin-bottom: 10px;
}

.nm_post_title a {
  text-decoration: none;
}

.nm_post_title a:hover {
  text-decoration: underline;
}

.nm_post_date {
  color: #999;
  font-size: 11px;
}

.nm_post_content {
  margin-bottom: 20px;
}

.nm_post_meta {
  padding: 2px 5px;
  border: 1px solid #ccc;
  background-color: #f9f9f9;
  font-size: 11px;
}

.nm_post_back {
  margin-top: 20px;
  font-size: 11px;
}

.nm_post_back a {
  text-decoration: none;
}

.nm_post_back a:hover {
  text-decoration: underline;
}

.nm_page_nav .left {
  float:left;
  text-align:left;
}

.nm_page_nav .right {
  float:right;
  text-align:right;
}

aside .section a, aside .section a {
  text-decoration: none;
}

aside .section a:hover, aside .section a:hover {
  text-decoration: underline;
}

aside .section a.large {
  font-size: 22px;
}

 

Customization

Since version 2.4.0 you can redefine all frontend language strings, allowing some basic customization. (With previous versions of the plugin, some of them could be modified by editing the language file, but then you had to be careful not to overwrite it when upgrading.)

To use this feature, you can insert some lines in your site's gsconfig.php file. Here's an example where we redefine the "Published on" string, the date format and those three dots after an excerpt:

$nm_i18n = array();
$nm_i18n["PUBLISHED"]   = "Posted on";
$nm_i18n["DATE_FORMAT"] = "%d.%m.%Y";
$nm_i18n["ELLIPSIS"]    = "...";

The first line is recommended.

This is the full list of frontend strings (with their default values):

$nm_i18n["FOUND"]       = "The following posts have been found:",
$nm_i18n["NOT_FOUND"]   = "Sorry, your search returned no hits.",
$nm_i18n["NOT_EXIST"]   = "The requested post does not exist.",
$nm_i18n["NO_POSTS"]    = "No posts have been found.",
$nm_i18n["PUBLISHED"]   = "Published on",
$nm_i18n["TAGS"]        = "Tags",
$nm_i18n["OLDER_POSTS"] = "&larr; Older Posts",
$nm_i18n["NEWER_POSTS"] = "Newer Posts &rarr;",
$nm_i18n["SEARCH"]      = "Search",
$nm_i18n["GO_BACK"]     = "&lt;&lt; Go back to the previous page",
$nm_i18n["ELLIPSIS"]    = " [...]",
$nm_i18n["LOCALE"]      = "en_US.utf8,en.utf8,en_US.UTF-8,en.UTF-8,en_US,en",
$nm_i18n["DATE_FORMAT"] = "%b %e, %Y"

It's not necessary to insert all lines, only those corresponding to texts you want to redefine (as in the example above).

Note that if you have non-English (US-ASCII) characters you must use a text editor that supports UTF-8 without BOM (e.g. Notepad++ for Windows) or use html entities for charactes like ä, é, ñ, ...

That's it, I hope you will enjoy it!

(Based on roog's original documentation in the first post of the old News Manager forum thread.)