Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-02-21, 04:59:59
(This post was last modified: 2013-07-20, 00:22:01 by Carlos.)
Several users have asked for enhancements in News Manager sidebar functions to add dates, excerpts, etc. to the recent posts list.
The News Manager Addons plugin provides additional functions/template tags to extend News Manager, so that you can customize it a bit (currently, only the sidebar latest posts)
Download (Extend)
Example - Recent posts with excerpts (different length to those in settings)
In your sidebar component, replace nm_list_recent() by:
PHP Code: nm_set_custom_excerpt(123); nm_custom_list_recent(' <a href="{{ post_link }}">{{ post_title }}</a><br /> {{ post_excerpt }} ');
Some of the available sidebar functions/template tags are:
nm_custom_list_recent($template)
nm_custom_display_recent($template)
nm_set_custom_date($dateformat)
nm_set_custom_excerpt($excerptlength)
nm_set_custom_maxposts($maxposts)
nm_list_recent_with_date($dateformat, $before=false)
nm_list_recent_by_tag($tag, $numposts=0)
$template is a string (HTML code) where these tokens can be used:
{{ post_link }} - absolute URL of post
{{ post_title }} - post title
{{ post_date }} - post date/time
{{ post_excerpt }} - post excerpt
{{ post_slug }} - post id
{{ post_number }} - number of post as displayed (0, 1, 2, ...)
[...]
More info here:
http://www.cyberiada.org/cnb/news-manage...ns-plugin/
(Sorry for the poor docs, I'll update them...)
Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-03-09, 21:01:00
(This post was last modified: 2013-03-09, 21:01:37 by Carlos.)
Is anyone using (or has tried) this complementary plugin? Opinions, suggestions?
(even about the name, with which I'm not convinced at all...)
Posts: 2,928
Threads: 195
Joined: Feb 2011
Carlos,
I will give it a try as I am working on a new site and in the moment I just use
Code: <?php nm_list_recent(); ?>
but I am sure we will need more functionality, my first next step will be to add tags because they have 2 categories ...
so I expect we will need "show recent 5 with date with that tag" or "list recent 5 with date with the other tag"
cheers, Connie
Posts: 1,927
Threads: 88
Joined: Apr 2010
in News Manager Addons plugin this tag breaks all
Code: <?php nm_set_custom_max_posts(5); ?>
this does not show anything
Code: <?php nm_set_custom_date('%d/%m/%Y'); ?>
These tags work well
Code: <?php nm_set_custom_excerpt(123); ?>
<?php nm_custom_list_recent('
<a href="{{ post_link }}">{{ post_title }}</a><br />
{{ post_excerpt }}
'); ?>
<?php nm_custom_display_recent('
<div class="my-recent">
<h4><a href="{{ post_link }}">{{ post_title }}</a></h4>
<span class="my_excerpt">{{ post_excerpt }}</span>
</div>
'); ?>
since I'm a complete zero in php, maybe I did not understand something
updated http://without-db.ru/news/obnovlenie-new...getsimple/
Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-03-17, 17:39:27
(This post was last modified: 2013-03-17, 17:40:47 by Carlos.)
(2013-03-17, 17:07:20)Oleg06 Wrote: in News Manager Addons plugin this tag breaks all
Code: <?php nm_set_custom_max_posts(5); ?>
this does not show anything
It's nm_set_custom_maxposts, without the underscore. I may change the name (or add an alias) to avoid confusion.
Anyway: all this is a bit experimental... I may change the functions to work a different way, or use components, ...
But I wanted people to have right now some way to customize the sidebar with dates and excerpts.
(I may add something like this to NM in the future, I just haven't decided how. I don't want to bloat roog's original creation.)
Posts: 1,927
Threads: 88
Joined: Apr 2010
Thanks, works
Code: <?php nm_set_custom_maxposts(2); ?>
Posts: 1,247
Threads: 82
Joined: Feb 2011
I thought it would be nice to have some sort of calendar view of the posts, categorising posts by date using month, week or year view. Maybe add support for future posts/events later.
This is probably out of range of the original functionally of this plugin, but I thought a calendar plugin is partly in the same group as a blog/news manager.
Posts: 3,491
Threads: 106
Joined: Mar 2010
Listing future posts with similar functions is already on my to-do list, I'll do it some day.
I had also thought about calendar-type archives, but that would take more time and I have other priorities, sorry.
Categorizing by week or year requires making changes in the News Manager plugin itself. For now, I only have yearly archives (instead of monthly) in my to-do list.
Thank you for your suggestions.
Posts: 3,491
Threads: 106
Joined: Mar 2010
I've fixed a typo in the documentation: the correct token is {{ post_number }}, not {{ post_count }}.
Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-06-21, 07:50:10
(This post was last modified: 2013-06-21, 07:50:37 by Carlos.)
News Manager Addons 0.4 beta available.
Updated to support the post images feature in News Manager 2.5 (currently in beta)
New tokens are:
{{ post_image_url }} - full URL of the post thumbnail/image
{{ post_image }} - html code for the thumbnail/image URL ( <img src="...)
If you want to override the default settings for displaying post images, you can change it (before using nm_custom_display, etc.) with function nm_set_custom_image($width=null, $height=null, $crop=null, $default=null).
Example:
Code: <?php nm_set_custom_image(100, 100); ?>
<?php nm_custom_display_recent('
<div class="my_recent_post">
<h4><a href="{{ post_link }}">{{ post_title }}</a></h4>
<div class="my_image">{{ post_image }}</div>
<span class="my_excerpt">{{ post_excerpt }}</span>
</div>
'); ?>
Cropped 200 (width) x 150 (height) images:
Code: nm_set_custom_image(200, 150, 1);
No cropping + default image in data/uploads (for posts that don't have one):
Code: nm_set_custom_image(200, 150, 1, 'image1.jpg');
(last parameter could also be the full image URL, 'http://....')
Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-06-24, 18:49:18
(This post was last modified: 2013-06-24, 18:53:34 by Carlos.)
News Manager Addons 0.5 beta available.
New function/template tag nm_list_recent_by_tag
Displays a list of recent posts that have a given tag. (original idea by @vincenzo; code rewritten from scratch)
Examples:
Code: <?php nm_list_recent_by_tag('beer'); ?>
Shows n latest posts with tag beer ( n as defined in News Manager settings)
Code: <?php nm_list_recent_by_tag('wine', 5); ?>
Shows 5 latest posts with tag wine
Posts: 6,266
Threads: 181
Joined: Sep 2011
Wouldn't it make more sense to get recent posts then filter by tag ?
filter(list_recent(),tag);
or somethng not so specific as nm_list_recent_by_tag, seems overly non modular. Or does this functionality already exist and this is an abstract function?
What if I want combinations of tags also ?
Posts: 3,491
Threads: 106
Joined: Mar 2010
It's a temporary thing (that's why I've added to this complementary plugin, not to NM itself) that Connie and others need.
I may add the functionality to existing nm_list_recent (that doesn't have parameters, so I can make use of this while keeping backwards compatibility), like:
nm_list_recent($tag='', $max=0) // $max = number of posts; 0 = use value in settings
As for combination of tags, I had thought about this, but as noone has ever asked for this I intended to leave this for the future. It could be comma-separated tags in the 1st parameter (for OR, and another separator for AND... still haven't thought about this)
Posts: 6,266
Threads: 181
Joined: Sep 2011
ahh, forgot what I was looking at for a second.
I guess someone could splice the results togather, but it probably be better if the function accepted a string or array as tag argument. with another boolean arg for and or OR.
And if you want to do and and or then well sol.
lol
Posts: 155
Threads: 10
Joined: Jul 2012
With this great plugin i can "make" news site with featuret slider .
Can u add post sorting by votes ( thumbs or something ) with ranking number, like most votes is on top with number 1 etc etc?
Posts: 3,491
Threads: 106
Joined: Mar 2010
(2013-06-26, 19:35:14)Riianna Wrote: Can u add post sorting by votes ( thumbs or something ) with ranking number, like most votes is on top with number 1 etc etc?
Are you suggesting that some voting system is implemented in News Manager? Or do you know of any external script or service that could be used for this?
Posts: 2,928
Threads: 195
Joined: Feb 2011
(2013-06-25, 06:44:41)Carlos Wrote: It's a temporary thing (that's why I've added to this complementary plugin, not to NM itself) that Connie and others need.
Carlos, it works great, see here below the image:
http://www.kunstundnatur-steinfurth.de/kulturhaus/
gracias, thanks!
Connie
Posts: 2
Threads: 1
Joined: Jul 2013
Where to download News Manager Addons 0.4 beta? I want to use {{ post_image }}
Posts: 3,491
Threads: 106
Joined: Mar 2010
You can download the latest 0.5 beta here:
https://raw.github.com/cnb/News_Manager_...addons.php
I'll update the docs (link in first post in this thread) to include {{post_image}}, etc. some day, after releasing News Manager 2.5
Posts: 155
Threads: 10
Joined: Jul 2012
(2013-07-06, 20:41:09)Carlos Wrote: (2013-06-26, 19:35:14)Riianna Wrote: Can u add post sorting by votes ( thumbs or something ) with ranking number, like most votes is on top with number 1 etc etc?
Are you suggesting that some voting system is implemented in News Manager? Or do you know of any external script or service that could be used for this?
Yes, thumb up/down or something like that.
Posts: 3,491
Threads: 106
Joined: Mar 2010
News Manager Addons 0.6 beta available.
New function/template tag nm_search_with_placeholder(): replacement for nm_search(), shows a placeholder text in the search input box.
It supports News Manager's 2.5 SEARCH_PLACEHOLDER language string, but the placeholder text can also be passed as a parameter, like:
Code: <?php nm_search_with_placeholder('Type words here...'); ?>
Posts: 3,491
Threads: 106
Joined: Mar 2010
News Manager Addons 0.7 beta available.
New second (optional) parameter in function nm_custom_display_recent (and nm_custom_list_recent) that lets you filter by tag.
Example:
Code: <?php nm_custom_display_recent('
<div class="my_recent_post">
<h4><a href="{{ post_link }}">{{ post_title }}</a></h4>
<span class="my_date">{{ post_date }}</span>
<span class="my_excerpt">{{ post_excerpt }}</span>
</div>
', 'books'); ?>
will display the latest posts with tag books (using the sample layout given as first parameter).
Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-08-03, 09:11:36
(This post was last modified: 2013-08-14, 08:09:18 by Carlos.)
News Manager Addons 0.8 beta available.
- new {{post_content}} token/placeholder for template strings
- added functions/template tags nm_custom_list_future and nm_custom_display_future (equivalent to nm_custom_list_recent and nm_custom_display_recent, but showing only scheduled posts, in ascending date order).
[update] version 0.8.1 beta - small fix in function nm_search_with_placeholder
[update] version 0.8.2 beta - another small fix, bad tag in function nm_search_with_placeholder - @D.O.
Posts: 3,491
Threads: 106
Joined: Mar 2010
Anyone using NM Addons to display post images? (in sidebar or whatever)
If so, note that image support works with NM 2.5 beta 10, but may not work properly with the next NM 2.5 beta release, as there have been some changes.
I'll update NM Addons soon.
Posts: 155
Threads: 10
Joined: Jul 2012
I´m using latest News Manger and Addons plugin.. images not show in "sidebar".
|