Thread Rating:
  • 4 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager (updated)
My humble smart contribution to your masterpiece!
=D

(2013-12-06, 01:24:31)Carlos Wrote: [quote='newdeepdan' pid='41533' dateline='1386177985']
I've recently been using this plugin, and its great! I was wondering if anyone can help me with is there some code to only show posts with certain tags?

Page 1: only show posts with 'blue' tag
Page 2: only show posts with 'red' tag

and so on.

I tried reading through all the pages of this topic but I didn't find a solution. Any help would be appreciated a lot. Thank you.

D.O. posted a tip, a way to do this (if I have understood well)

Code:
<?php
  if (return_page_slug()=='page-1') nm_show_tag('blue');
  if (return_page_slug()=='page-2') nm_show_tag('red');
?>
Reply
<h3> styling for Title

I'm using News Manager 2.5 beta 14.
My posts (in the browser "View Source") show <h3> style for the Titles. In version 2.4.4 this style came from the file site.php and was easy to change to <h5>. However in 2.5 beta 14 I cannot find any reference to <h3>. Where is this style coming from?
Quote:From browser view source:
<div class="nm_post">
<h3 class="nm_post_title">Sep 29, 2013 - <a href="http://www.lbqa.org/?post=us-sailing-team-wins-first-pan-pacific-university-sailing-championship">U.S. Sailing Team Wins First Pan-Pacific University Sailing Championship</a></h3>
</div>
Reply
Hi ochsadad!
Well, I checked it and it is still there. You can still find the tag <h3> in site.php file.
Reply
(2013-12-22, 03:43:30)D.O. Wrote: Hi ochsadad!
Well, I checked it and it is still there. You can still find the tag <h3> in site.php file.

Thanks for your response!
In the print post data section of site.php, I find the following:
# print post data ?>
<<?php echo $nmoption['markuppost']; ?> class="nm_post<?php if ($nmoption['pagetype'] == 'single') echo ' nm_post_single'; ?>">
<<?php echo $nmoption['markuptitle']; ?> class="nm_post_title"><?php
if ($nmoption['titlelink'])
echo '<a href="',$url,'">',$title,'</a>';
else
echo $title;
?>

The <h3> tag is not there (where it used to be). I do not find it anywhere in the file.
Reply
Well if u use the version 2.4.4 you have to change the line "<h3 class="nm_post_title">" in (example) "<h5 class="nm_post_title">

instead the versione 2.5.14 beta use the option "markuptitle" to do it...

Take a look at Carlo's personal website

http://www.cyberiada.org/cnb/news-manage...25-beta-14


Thanks for your response!
In the print post data section of site.php, I find the following:
# print post data ?>
<<?php echo $nmoption['markuppost']; ?> class="nm_post<?php if ($nmoption['pagetype'] == 'single') echo ' nm_post_single'; ?>">
<<?php echo $nmoption['markuptitle']; ?> class="nm_post_title"><?php
if ($nmoption['titlelink'])
echo '<a href="',$url,'">',$title,'</a>';
else
echo $title;
?>

The <h3> tag is not there (where it used to be). I do not find it anywhere in the file.
[/quote]
Reply
(2013-12-22, 03:36:15)ochsadad Wrote: <h3> styling for Title

I'm using News Manager 2.5 beta 14.
My posts (in the browser "View Source") show <h3> style for the Titles. In version 2.4.4 this style came from the file site.php and was easy to change to <h5>. However in 2.5 beta 14 I cannot find any reference to <h3>. Where is this style coming from?
Quote:From browser view source:
<div class="nm_post">
<h3 class="nm_post_title">Sep 29, 2013 - <a href="http://www.lbqa.org/?post=us-sailing-team-wins-first-pan-pacific-university-sailing-championship">U.S. Sailing Team Wins First Pan-Pacific University Sailing Championship</a></h3>
</div>

Just open the News Manager settings, allow custom settings and add the following to the textarea that will appear

Code:
# Change of heading levels
markuptitle h2
single markuptitle h1

The first one sets titles to h2 generally and the second with "single" sets h1 for full articles only. You can change these h2 and h1 to whatever you want.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
@ochsadad

My News Manager clone's beta version code is getting a bit more complicated to patch (the original was quite clean and understandable), but hopefully most of those patches will no longer be necessary with the new options and custom settings.

D.O. and TeeJay have already told you about the new custom setting markuptitle... so if you want to use <h5> in every news page:
Code:
markuptitle h5

I'll try to make some decent docs for these new features before releasing the stable version. (In the meantime, don't hesitate to ask any "How do I ...")

Curious, are you doing other patches besides this one?
Reply
Hi Carlos, yes I know markuptitle as u can see, I advised to Ochsadad your new option markuptitle and sent it your website.. At the moment I am not using ur beta version with Partenope.org but I suppose that I have to update it as soon as possible tho I modified NM because I needed the date and the tags on the same line (yes another patch). It could be great to create an option for this... and I am glad you added thee function nm_tag_list... I am still using mine :-P but I think it's time to update it with yours. Read YOu later bro!
Reply
@Carlos

Thanks to you, D.O., and TeeJay for your assistance. Your solution is much easier and more elegant than modifying the code.
Reply
Too Kind, Ochsadad, tho I think only Carlos deserves a big THANKS from all of us
His work with NewsManager is superb.

(2013-12-23, 04:10:09)ochsadad Wrote: @Carlos

Thanks to you, D.O., and TeeJay for your assistance. Your solution is much easier and more elegant than modifying the code.
Reply
(2013-12-22, 07:38:22)Carlos Wrote: @ochsadad

My News Manager clone's beta version code is getting a bit more complicated to patch (the original was quite clean and understandable), but hopefully most of those patches will no longer be necessary with the new options and custom settings.

D.O. and TeeJay have already told you about the new custom setting markuptitle... so if you want to use <h5> in every news page:
Code:
markuptitle h5

I'll try to make some decent docs for these new features before releasing the stable version. (In the meantime, don't hesitate to ask any "How do I ...")

Curious, are you doing other patches besides this one?

Carlos,

I've patched site.php to put the date and title on the same line.
Quote:<<?php echo $nmoption['markuptitle']; ?> class="nm_post_title"><?php
if ($nmoption['titlelink'])
echo $date . " - " . '<a href="',$url,'">',$title,'</a>';
else
echo $date . $title; ?>

My "news" page is my home page: http://www.lbqa.org

Thanks, again!
Reply
Great Site!
The template is by Timbow cool! it's even responsive!

(2013-12-23, 05:10:48)ochsadad Wrote: [quote='Carlos' pid='41777' dateline='1387661902']

Carlos,

I've patched site.php to put the date and title on the same line.
Quote:<<?php echo $nmoption['markuptitle']; ?> class="nm_post_title"><?php
if ($nmoption['titlelink'])
echo $date . " - " . '<a href="',$url,'">',$title,'</a>';
else
echo $date . $title; ?>

My "news" page is my home page: http://www.lbqa.org

Thanks, again!
Reply
I have been racking my brains trying to figure it out but am coming up short. At the moment I am using news manager but would like to display static content above it. So far I have been un successful and would like some suggestions on how I might achieve this?
Reply
What do you mean?
Do you want to show in the same page a (e.g.) static content before of your news?


(2013-12-23, 14:13:55)Craziwolf Wrote: I have been racking my brains trying to figure it out but am coming up short. At the moment I am using news manager but would like to display static content above it. So far I have been un successful and would like some suggestions on how I might achieve this?
Reply
(2013-12-23, 14:13:55)Craziwolf Wrote: I have been racking my brains trying to figure it out but am coming up short. At the moment I am using news manager but would like to display static content above it. So far I have been un successful and would like some suggestions on how I might achieve this?

I think I can tell you how to Smile

Let's say you have page in GS called 'News'. In GS, you can set a template the page will use.
  • So, create an extra template just for this page. You can just copy the global template, file template.php which is in your /theme/ThemeName/ folder).
  • Call it like "templateNews.php" or whatever - it doesn't matter at all.
  • Set the templateNews.php as the template of the GS page 'News' (go to the administration, open the News page and in its preferences, there, you can set the template for the page).

  • Now you have a place where you can put static content above the content.

  • Open the templateNews.php and put your static content above
    Code:
    <?php get_page_content(); ?>
    There you go Smile

One thing to make it easier for you is that instead of creating a brand new template, you can just add the content to your global template (template.php), but you have to wrap the static content between
Code:
<?php if (return_page_slug()=='news')  { ?> and <?php } ?>


This is what you have to do if you use the latest stable version. However, there is a trouble about it - it will be shown not only above the list of the posts (main news page, 'News'), but also above each post when you click it. If you want to to fix this, I think you have to use latest beta (a few posts above). I use it on a live site, see my signature, you don't have to worry.

For the beta, solution is much easier as there are special functions that can make your life easier:
  • You don't have to create any special template. (Well, you don't have to in the previous solution either, but it's even more elegant now because of some nice functions)
  • You can set what static content will be above the list of the posts and what above the posts itself when you open them
  • So, again, as in the previous case, open your template that the page with your posts uses. Usually template.php in /theme/YourThemeName/, but it can be a different according to your edits.
  • The static content you want to show above the complete list of posts ONLY (main news page), wrap between
    Code:
    <?php if (nm_is_main()) { ?> and <?php } ?>
    . This static content won't be shown above any of the posts when you open them.
  • The static content you want to show above each of your posts, wrap between
    Code:
    <?php if (nm_is_single()) { ?> and <?php } ?>

Don't forget to place it properly in the code. In most cases, it should be directly above the <?php get_page_content(); ?> tag.

In case you're using beta and you want to show the same static content above both the main news page and all the posts, you can use the solution with the "slug condition", or just join these two functions (nm_is_single(), nm_is_main()) with logical OR.

Hope this is the answer you were looking for Smile
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
This is how I may do it - code to be inserted in your template, somewhere above the get_page_content() tag)

News Manager until 2.4.x:
PHP Code:
<?php
global $NMPAGEURL;
if (
strval(get_page_slug(false))==$NMPAGEURL && !isset($_GET['post']) && !isset($_GET['page']) && !isset($_GET['tag']) && !isset($_GET['archive'])) {
?>
... your static content...
<?php ?>

NM 2.5 beta (current):
PHP Code:
<?php if (nm_is_home()) { ?>
... your static content...
<?php ?>

These would be for displaying that content only in the main news page (not in secondary pages, archives, tag view...). Other possibilities would require different conditionals (nm_is_main, nm_is_site, ... in 2.5 beta)

Of course, there are several ways to do it, as you can see in TeeJay's previous post.
Reply
Hey Carlos,
I am astounded!
I was gonna post one of my old tips like...
PHP Code:
<?php
if (isset($_GET['post']) || ""){
include(
'content.php');
?>

...But your new NM 2.5 ROCKS for REAL..
I have to renew my site with your new NM functions!
Reply
News Manager 2.5 beta 15 attached to this post.

New custom settings:
- imageclass
- imagesize
- excerptlength
- showfields (@D.O., @ochsadad)
- componentbottompost
- componentafterpost

imageclass
Lets you set a custom class for post images.
For example, if you use Bootstrap or Skeleton (or nickpack/Ribs) you can add class "scale-with-grid" to make post images responsive:
Code:
imageclass scale-with-grid

imagesize
Lets you customize width, height and cropping of post images overriding your normal settings.
Parameters separated by commas and/or spaces; 0 or full for original image.
(it's just a shorthand for imagewidth, imageheight and imagecrop)
For example, if you want full images in single post view, and cropped 90x90 images in archives:
Code:
single imagesize full
archive imagesize 90,90,1

excerptlength
Lets you customize the excerpt length, overriding the one defined in NM settings. Can be used to e.g. have shorter excerpts in archives, etc.

showfields
Allows simple customization of post layout. You can specify what fields to display in the order you wish.
Fields can be separated by comma and/or blanks. Default is title,date,author,image,content,tags
(author and image are not used by default - only displayed if they are enabled)

componentbottompost
You can specify a GS component to be rendered in the bottom of the post (before its container's closing tag - div by default)

componentafterpost
You can specify a GS component to be displayed after the post

These last two component-related settings can be useful for e.g. integrating external comment support.
This is how I'm doing to have disqus comments in my site's NM blog:
- I uploaded and activated the External Commenting plugin.
- I created a component named post-comments with this content:
PHP Code:
<?php
get_external_comments
(
  
'news-manager-blog/'.nm_post_slug(0),
  
nm_post_url(0),
  
nm_post_title('','',0)
);
?>
(news-manager-blog/ is a custom prefix for the post id - use your own preferred one)
- I added this to my Custom Settings:
Code:
single componentafterpost post-comments
(only for the single post view)

(For the already existing custom settings in 2.5 betas, see: What was new in beta 13, beta 14)

Please report any issues or bugs you find.

[attachment removed: news_manager-2.5-beta15.zip (Size: 70.92 KB / Downloads: 42) ]
Reply
You are Great, Carlos! I have to test it absolutely now!
Reply
If anyone is interested in integrating the External Commenting plugin with the News Manager (updated) stable version (2.3.x and up) I can post here a small snippet to be inserted in your template or a component.

(There already was some solution for this in an old thread, but AFAIR it required patching the plugin.)
Reply
Thanks for the new beta, works great as expected Smile

I have just implemented cumbe's beta of Pages & Comments when redesigning my website and I was wondering how to put facebook likes after the post but before the comments - these components are exactly what I needed and I guess I'm not alone (yes, finally I got rid of external commenting system and got cumbe's beta also into News Manager).

I'm gonna implement Google authorship for my website, so I will also need an author's box. The author's paragraph or span or whatever it is now is not enough, I will need a whole div with a photo and longer text and some links to social sites, these components can serve me for this also perfectly.
But maybe - I don't know, just a sudden thought, it might be good to make some space in NM setting for such author's box HTML code after clicking onto a checkbox... maybe it would make the settings more complicated, it's not really necessary as components are the same just at a different spot, but you decide Smile
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
Thanks for testing and reporting.

If your site is one-author, I suppose you can just put your Google authorship code in a component or in the template.

This is how I intend to enhance the (currently very basic) author support in the beta version:

- add some function to display/return the post author (or for use in conditionals)
- allow setting aliases for authors (e.g. to show user name "jsmith" as "John Smith", "admin" as "Administrator", ...) probably in an array in gsconfig.

But no new backend settings for now.
Reply
Add news categories function and snippet to show recent news from specifig category Big Grin
Reply
Carlos, this "Alias" option is wonder.
I bet you made it for me :-D Gracias again!


(2014-01-06, 02:41:16)Carlos Wrote: Thanks for testing and reporting.
- add some function to display/return the post author (or for use in conditionals)
- allow setting aliases for authors (e.g. to show user name "jsmith" as "John Smith", "admin" as "Administrator", ...) probably in an array in gsconfig.
Reply
Hi Riianna,
for showing recent news from specifig category
I used News Manager Addons by Carlos for a site and it works wonderfully.

e.g.
PHP Code:
<?php nm_list_recent_by_tag('good-news',4); ?>

But I dunn
o if nm_list_recent_by_tag will work again with the new NM version

I will reply later and will let you know.


(2014-01-08, 10:13:54)Riianna Wrote: Add news categories function and snippet to show recent news from specifig category Big Grin
Reply




Users browsing this thread: 1 Guest(s)