News Manager blog

News Manager 2.5 beta: new features

News Manager 2.5 beta has several new "hidden" features (not available directly in Settings): you can have

  • thumbnails / featured images for your posts;
  • a "read more" link after the post excerpt.
  • post titles without link (for single post pages, but can be done with other or all news pages)
  • optional yearly archives (instead of monthly)
  • hidden/internal tags (beginning with underscore, _. They're not shown, but are searchable with ?tag= or /tag/ in the URL)
  • extra Save post and Save settings buttons in admin sidebar
  • custom date format in sidebar archives
  • optional placeholder text in search input box (HTML5)

POST THUMBNAILS / FEATURED IMAGES

Setup - Backend:

Insert this line in your site root gsconfig.php file:

$NMIMAGEINPUT = true;

A new field "Image" (in English) will be available in the post options, where you can insert the image URL/name, full or relative to data/uploads/  or click the file browser button, which opens a new window where you can select a (previously uploaded) image.

Examples:
myimage.jpg or http://example.com/data/uploads/myimage.jpg
images/myimage.png or http://example.com/data/uploads/images/myimage.png

You can also set  the position of the Image input box in the post edit page by using one of these:

$NMIMAGEINPUT = 0; // or FALSE : not visible
$NMIMAGEINPUT = 1; // in Options, first field
$NMIMAGEINPUT = 2; // or TRUE : in Options, last field
$NMIMAGEINPUT = 3; // directly visible above content
$NMIMAGEINPUT = 4; // directly visible below content

By default, the file browser lets you select images in the data/uploads folder. If you want to select from a certain subfolder, you can use this gsconfig setting:

$NMIMAGEDIR = 'images';

(default subdirectory for image selection, relative to data/uploads - e.g. 'images'  for data/uploads/images/)

Frontend settings:

You can define the way you want post images to be displayed, like this:

$NMIMAGES = array('width' => 100, 'height' => 100);

Another example, setting all values (in several lines):

$NMIMAGES = array(
'width' => 250,
'height' => 100,
'crop' => 1,
'default' => 'mydefaultimage.jpg',
'alt' => true,
'title' => true,
'link' => true,
'external' => false
);

You can insert that in gsconfig.php, or if you prefer to be able to edit those settings in your GS admin panel, it can be placed in your theme's functions.php file.

All settings are optional. Quick explanation:

  • width: width of the scaled image
  • height: height of the scaled image
  • crop: default 0; If 0 or false, the image is scaled to have at most width / height dimensions; if 1 or true, it is cropped to exacly fit the width / height ratio
  • default: image to be displayed in posts that have no image set. Full URL or relative to data/uploads/)
  • alt: if true or 1, the <img> tag will have an alt="post title" attribute. Default: false (0)
  • title: if true or 1, the <img> tag will have a title="post title" attribute. Default: false (0)
  • external: default true; display images that are not in data/uploads (but they will not be resized). If set to false, external images will be ignored - show: default true. Set it to false to disable display of post images in the frontend
  • link: if true or 1, images will have a link to the post. Default: false (0)
  • show: default true; display post images. Set it to false or 0 to disable this feature for the frontend

Post images will be inserted just before the post excerpt. They will not be shown in full posts.

Resized images are cached (stored in data/thumbnails/)

CSS

You can style images with new class nm_post_image, example:

nm_post_image {
  float:left;
  border:1px solid #ccc;
  margin-right:20px;
  padding:0!important;
}
.nm_post_title { clear:both }

(See another example by D.O.)


OPTIONAL "READ MORE" LINK

Enable "read more" links by adding this to gsconfig:

$NMREADMORE = true;

Or if you want the "read more" always, even if the post content is shorter than the maximum excerpt length:

$NMREADMORE = 'a';

You can change the default "read more" text. Example:

$nm_i18n['READ_MORE'] = 'Continue reading';

Use this in gsconfig.php or in your theme's functions.php.


REMOVE LINK TO POST IN TITLES

You can now remove the link from the post title with the $NMTITLENOLINK config variable.
Usage examples:

// remove link to self in single post title

$NMTITLENOLINK = 'single';

// remove link in post title in single, main and tag pages:

$NMTITLENOLINK = 'single, main, tag';

available strings:
single, main, tag, archive, search


YEARLY ARCHIVES

You can have yearly archives instead of monthly (default).
Enable with this gsconfig setting:

$NMARCHIVESBY = 'y';

Use this setting in your gsconfig.php file or in your theme's functions.php

 


CUSTOM DATE FORMAT IN SIDEBAR ARCHIVES

Sidebar function nm_list_archives now has an optional string parameter for date format (strftime).
Examples:

// month, year:
<?php nm_list_archives('%B, %Y'); ?>

// year/monthnumber:
<?php nm_list_archives('%Y/%m'); ?>

 


 PLACEHOLDER TEXT IN SEARCH BOX

New (optional) language string for placeholder text in search box (HTML5). Usage (gsconfig):

$nm_i18n['SEARCH_PLACEHOLDER'] = 'Enter words here...';

« Back to News Manager blog

blog comments powered by Disqus