Thread Rating:
  • 6 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager (updated)
(2016-11-03, 02:54:23)olmy Wrote:
(2016-10-29, 16:18:06)Riianna Wrote: How to get post number like addons plugins have?.
Example:  1 Published on Sep 29, 2016, 2 Published on Sep 29, 2016 etc.

Posts don't have ID numbers, the ID is the 'slug'

News Manager Addons plugin has post number, so i assumet it would be possible to put number to news posts Big Grin.

Anyway how to hide news with specifig tag, so they dont show in news listing page?.
Reply
@Rianna

It will somehow be possible to display the post number when custom post rendering is supported (I'd like to have this for next version).

You can exclude posts that have a given tag (or tags) since NM 3.4 with gsconfig setting NMDEFAULTEXCLUDETAGS (see here)
Reply
(2016-11-04, 01:49:16)Carlos Wrote: @Rianna

It will somehow be possible to display the post number when custom post rendering is supported (I'd like to have this for next version).

You can exclude posts that have a given tag (or tags) since NM 3.4 with gsconfig setting NMDEFAULTEXCLUDETAGS (see here)

Thanx, cant get the FAQ plugin to work, so i use news manager and tag faq for this Big Grin.
Reply
I've done a dirty hack to get a few custom fields in NM, but it works fine for my use of NM as an event manager.
post edit pic below, the site is http://22330.fr.

Thanks Carlos for all your hard work.
Philip    
Reply
(2016-11-09, 20:52:32)Riianna Wrote: Is it possible to assign specifig template to single post view?.

In NM Settings, enable Custom settings and enter:
Code:
single templateFile filename.php
where filename.php is your alternate template file name.
Reply
Great thanx. Works in tag page too Big Grin.
How about showing single tag of current news with post count, not the whole tag list.
Reply
I found it usefull to be able to clone a post. Here's how I did it:

added to the end of posts.php

PHP Code:
function nm_clone_post($slug) {


  $oldfile NMPOSTPATH.$slug.'.xml';
  $v=0;

  $pos strrpos($slug"-");
  if ($pos !== FALSE) {
    $v = (int) substr($slug,$pos+1);
    if ($v$slug substr($slug,0,$pos);
  }
  $v++;
  $newfile NMPOSTPATH.$slug.'-'.$v.'.xml';

  if (copy($oldfile$newfile)) {
      nm_generate_sitemap();
  } else {
      nm_display_message(i18n_r('news_manager/ERROR_SAVE'), true);
  }




in edit_post.php

PHP Code:
<?php

    
if (!$newpost) {
      ?>
      /
      <a href="load.php?id=news_manager&amp;clone=<?php echo $slug?>" class="cancel">
        <?php i18n('news_manager/CLONE'); ?>
      </a>
      /
      <a href="load.php?id=news_manager&amp;delete=<?php echo $slug?>" class="cancel">
        <?php i18n('news_manager/DELETE'); ?>
      </a>
      
      <?php
    
}
    ?>

in news_manager.php

PHP Code:
function nm_admin() {

  if (nm_env_check()) {
    # post management
    if (isset($_GET['edit'])) {
        nm_edit_post($_GET['edit']);
    } elseif (isset($_POST['post'])) {
        nm_save_post();
        nm_admin_panel();
        /*****/
    } elseif (isset($_GET['clone'])) {
        nm_clone_post($_GET['clone']);
        nm_admin_panel();
        /*****/
... 

and in lang/en_US.php, add

Code:
"CLONE"                  =>  "Clone",

Carlos, please correct me if I've missed something!
Philip

** updated because buggy nm_clone_post
Reply
(2016-11-10, 08:06:50)Riianna Wrote: How about showing single tag of current news with post count, not the whole tag list.

Since NM 3.1 you can use <?php nm_single_tag_title(); ?> to display the current tag if on a tag page.

To display the post count for the current tag, add this to your theme's functions.php file (create it if it doesn't exist):

PHP Code:
if (!defined('nm_single_tag_count')) {
  function 
nm_single_tag_count() {
    
$tag nm_single_tag_title(''''false);
    if (
$tag) {
      
$tags nm_get_tags();
      echo 
count($tags[$tag]);
    }
  }


and then you can display the number with:
Code:
<?php nm_single_tag_count(); ?>

For example, you can do this in your template:
PHP Code:
<?php if (nm_is_tag()) { ?>
  <?php nm_single_tag_title(); ?><?php nm_single_tag_count(); ?> post(s)
<?php ?>
(so that the code is only run if on a tag page)

I may add that function to the plugin...
Reply
(2016-11-11, 05:53:15)Carlos Wrote:
(2016-11-10, 08:06:50)Riianna Wrote: How about showing single tag of current news with post count, not the whole tag list.

Since NM 3.1 you can use <?php nm_single_tag_title(); ?> to display the current tag if on a tag page.

To display the post count for the current tag, add this to your theme's functions.php file (create it if it doesn't exist):



PHP Code:
if (!defined('nm_single_tag_count')) {
 
 function nm_single_tag_count() {
 
   $tag nm_single_tag_title(''''false);
 
   if ($tag) {
 
     $tags nm_get_tags();
 
     echo count($tags[$tag]);
 
   }
 
 }


and then you can display the number with:


Code:
<?php nm_single_tag_count(); ?>

For example, you can do this in your template:


PHP Code:
<?php if (nm_is_tag()) { ?>
  <?php nm_single_tag_title(); ?><?php nm_single_tag_count(); ?> post(s)
<?php ?>
(so that the code is only run if on a tag page)

I may add that function to the plugin...


Great again thanx Big Grin. Trying to "make" a website to a friend who needs "catalog" for few items and host has no mysql support, so cant use WP,  and item manager is too complicated for her. So i try to use news manager as "very easy to use" catalog Big Grin.
Also does News manager addons plugin have snippet to show all posts from current tag?.
Reply
Is there a way to write a description for each post in Metatags?
Reply
Not currently, but it's in the to-do list (#255)

For automatic generation of meta description (as a post content excerpt), you can enable NM Custom Settings and enter:
Code:
autometad 1
(It works the same as GetSimple's GSAUTOMETAD gsconfig setting, but for posts.)
Reply
Are you able to show me the easiest (and maybe the fastest) way to make my posts being shown in grid? I was thinking about styling nm_post_recent and adding it to page content, but is there any other way to build post grid?
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
nm_custom_display_recent(); is super cool, super easy way to do it .. you have placeholders for title, image etc. and you just use regular html markup for posts. it's great for recent posts in sidebar, on landing page etc..

more info here: http://www.cyberiada.org/cnb/news-manage...ns-plugin/
Reply
(2016-12-01, 18:56:07)morvy Wrote: nm_custom_display_recent(); is super cool, super easy way to do it .. you have placeholders for title, image etc. and you just use regular html markup for posts. it's great for recent posts in sidebar, on landing page etc..

more info here: http://www.cyberiada.org/cnb/news-manage...ns-plugin/

Yeah, it's working as I expected, but post_link is broken, I mean it generates broken post address with two slashes, like mysite.com//post/mypost.
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
Aaaaand it would be nice if there was an option to choose a template for post, like one would be with sidebar, another seen as full-width etc.
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
double slash must be a bug in your config, it does work well for me..

you can have different template file for single post and different for blog home page. if you want, you can also have different layout for archive, tags ... all is possible thanks to nm_is_archive, nm_is_home functions + you can use advanced config and set custom template file for posts .. everything is written in this thread (I was able to understand steps and I'm not a pro programmer)
Reply
I cannot reproduce the double slash issue. Are you using some unusual custom permalink structure or website url? Any NM custom url parameters in gsconfig?

I intend to support some basic custom post rendering in NM 3.5.
Reply
(2016-12-02, 00:10:35)morvy Wrote: double slash must be a bug in your config, it does work well for me..

you can have different template file for single post and different for blog home page. if you want, you can also have different layout for archive, tags ... all is possible thanks to nm_is_archive, nm_is_home functions + you can use advanced config and set custom template file for posts .. everything is written in this thread (I was able to understand steps and I'm not a pro programmer)
I'm not a programmer either and I also read all the documentation at Carlos' website. About that templates - I would like to choose if post will be shown with sidebar or in fullwidth template, apart from archives and main blog templates. But I'll look once again for any tips there.

(2016-12-02, 01:48:12)Carlos Wrote: I cannot reproduce the double slash issue. Are you using some unusual custom permalink structure or website url? Any NM custom url parameters in gsconfig?

I intend to support some basic custom post rendering in NM 3.5.
Nope, I checked htaccess and advanced config and everything looks okay. But I fixed it by setting up my own urls in nm_post_display_recent (or sth).
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
(2016-12-02, 04:23:48)Artur Wrote: About that templates - I would like to choose if post will be shown with sidebar or in fullwidth template, apart from archives and main blog templates. But I'll look once again for any tips there.

In NM Settings, enable Custom settings and enter:
Code:
single templateFile full-width.php
where full-width.php is your alternate template file name for the single post view.

(2016-12-02, 01:48:12)Carlos Wrote: Nope, I checked htaccess and advanced config and everything looks okay. But I fixed it by setting up my own urls in nm_post_display_recent (or sth).

You mean you made changes to the plugin?
[edit] Ok, I suppose you appended {{post_slug}} to hardcoded url prefix.
But I'm intrigued about your issue, I'd like to know if I should fix something in NM Addons.
Reply
(2016-12-02, 04:53:55)Carlos Wrote:
(2016-12-02, 04:23:48)Artur Wrote: About that templates - I would like to choose if post will be shown with sidebar or in fullwidth template, apart from archives and main blog templates. But I'll look once again for any tips there.

In NM Settings, enable Custom settings and enter:
Code:
single templateFile full-width.php
where full-width.php is your alternate template file name for the single post view.

(2016-12-02, 01:48:12)Carlos Wrote: Nope, I checked htaccess and advanced config and everything looks okay. But I fixed it by setting up my own urls in nm_post_display_recent (or sth).

You mean you made changes to the plugin?
[edit] Ok, I suppose you appended {{post_slug}} to hardcoded url prefix.
But I'm intrigued about your issue, I'd like to know if I should fix something in NM Addons.
I think you don't understand me, or it's too late for me to encode your answers. Wink
With that command I will change template for all posts, and I already fixed it by setting invisible page named Posts as the main post page, and on my main site page adding display recent post code. But if I have posts named Post1, Post2 and Post3, I'd like to set Post2's template as fullwidth.php, and default template for others.
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
My site's blog "config" looks like below:

As a "Page to display posts" I have page Posts build on blog.php template. I'm showing all of them on Index page - I have main.php template and there I coded displaying recent posts there using that code:
Code:
<?php nm_custom_display_recent('
                      <div class="col-md-6">
<div class="news-image"><a href="/post/{{ post_slug }}">{{ post_image }}</a></div>
<h2 class="news-title"><a href="/post/{{ post_slug }}">{{ post_title }}</a></h2>
                        <p class="post-date"><em>{{ post_date }}</em></p>
                    <p class="post-content">{{ post_excerpt }} [...] <a href="/post/{{ post_slug }}">Czytaj dalej</a></p>
                    </div>
                '); ?>
Links look like this because when I use {{ post_link }}, I keep getting mysite.com//post/asdf links.
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
So you enabled NMNOPARAMPOST in gsconfig... Still cannot reproduce. Am I missing anything else? What GS, NM and NM Addons versions? Are other links in the site being generated properly? (navigation menu, NM links -tags, archives, etc.- ...)

As for the full-width template for a specific post, I suppose that you could, for example:
- rename blog.php (the template you have selected in your news page) to blog-default.inc.php
- create new file blog.php with this:
PHP Code:
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); }

if (
nm_post_slug(false) == 'post2') {
  include 
'blog-full-width.inc.php';
} else {
  include 
'blog-default.inc.php';


(Not tested)
Reply
No, I didn't enable anything like that, I only changed order of posts' elements, defined NMIMAGEDIR and set my own "Read more" text. Every other links are okay.

I'll test that script, but I'll be waiting for that feature in next NM version.
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
Another problem I can see is with tags. Check http://glowczynski.pl/post/start-start It's my post, below the content are listed tags. I understand that link has /posty/ in it, because main page I chose for posts is Posty, but why /index/?
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
It seems you're doing changes on the site. I just checked and see no tags.

I suppose your page 'posty' is a subpage of index, so the links are generated as /index/posty/... (unless you define a custom permalink structure without %parent% )
Reply




Users browsing this thread: 6 Guest(s)