Thread Rating:
  • 4 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager (updated)
(2017-08-22, 05:33:41)carpman Wrote: Is it possible to have different template files for different kinds of posts, as per:
single templateFile template-blog-post.php

But perhaps determined by tag, so for example, for image based posts I'd like to use one kind of template, for text based posts another. So I'd like to have a tag "image" and a tag "text" and depending which tag the post has, a different template file is used.

Something like this in custom settings?
single templateFile tag="text" template-blog-post-text.php
single templateFile tag="image" template-blog-post-image.php

Is this possible currently?
I'm not bothered about method (as per above), just whether this can be done at present.

Many thanks,
C.

Create a new template file (e.g. template-blog-single.php) with this contents:
PHP Code:
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); }

function 
custom_include_template($temp) {
  global 
$TEMPLATE;
  
$file GSTHEMESPATH.$TEMPLATE.'/'.$temp;
  if (
file_exists($file)) include $file;
}

if (
nm_post_has_tag('text')) {
  
custom_include_template('template-blog-post-text.php');
} elseif (
nm_post_has_tag('image')) {
  
custom_include_template('template-blog-post-image.php');
} else {
  
custom_include_template('template-blog-post.php');
}

// end 

Now in NM Custom Settings, select it with:
Code:
single templateFile template-blog-single.php

PS I suggest you use the .inc.php extension instead of just .php for these "special templates" so that they cannot be selected for normal pages by your users.
Reply
(2017-09-03, 21:24:08)Craziwolf Wrote: Hi Carlos, I was trying to figure out how to display my featured image in my side component. at the moment I can display some posts at random with an excerpt but cant get my feature image to work.

Here is my code without the feature image, where should I be inserting it?

You can use the {{ post_image }} or {{ post_image_url}} placeholders (see NM Addons documentation) wherever you need it in your code. Perhaps before the <h3>, or after the <br />, or after the excerpt... It depends on what you need, but you'll probably have to use css too...

(2017-09-06, 08:52:21)Craziwolf Wrote: Hello again! I do have another question, how do I make the feature image full width of the div when the post opens up on its own page? I am trying to make it show as a thumbnail in the main window and full size on the post.

Enter this in NM Custom Settings:
Code:
single imageSize full
Reply
(2017-09-12, 03:58:36)Carlos Wrote: Create a new template file (e.g. template-blog-single.php) with this contents:
PHP Code:
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); }

function 
custom_include_template($temp) {
 
 global $TEMPLATE;
 
 $file GSTHEMESPATH.$TEMPLATE.'/'.$temp;
 
 if (file_exists($file)) include $file;
}

if (
nm_post_has_tag('text')) {
 
 custom_include_template('template-blog-post-text.php');
} elseif (
nm_post_has_tag('image')) {
 
 custom_include_template('template-blog-post-image.php');
} else {
 
 custom_include_template('template-blog-post.php');
}

// end 

Now in NM Custom Settings, select it with:
Code:
single templateFile template-blog-single.php

PS I suggest you use the .inc.php extension instead of just .php for these "special templates" so that they cannot be selected for normal pages by your users.

Thanks Carlos !!!!! That worked a treat. It's allowed me to a) use different header images, fonts etc .. for different kinds of posts, but more importantly I no longer need to run media based js (say for the audio player) on simple text posts.

You can see it in action here:

Main Blog (Directory)
http://www.giantpygmy.net/gptxt/index.php

Image Post
http://www.giantpygmy.net/gptxt/?post=im...ry-beacons

Text Post
http://www.giantpygmy.net/gptxt/?post=i-dont-know-why

Thanks again! It's made a big difference.  Big Grin

C.
Reply
I have a really dumbass question to ask (so please feel free to smack me round the head with your answer) - but I was going through the documentation and couldn't find out how to include a link within a "single post" to jump to next post (later or more recent) thus bypassing returning to the main blog page (list of posts).

I'm certain I'm missing something but the only older/newer link I could find is under page navigation: navOldNew
and what I'm after is the same kind of thing but for (within) post navigation to bypass the in/out menu issue.

That said when I go to a major blog like Zerohedge, they don't have that option - so maybe it's not so easy.

Any help much appreciated.

C.
Reply
(2017-09-19, 15:56:02)carpman Wrote: I have a really dumbass question to ask (so please feel free to smack me round the head with your answer) - but I was going through the documentation and couldn't find out how to include a link within a "single post" to jump to next post (later or more recent) thus bypassing returning to the main blog page (list of posts).

See here: http://get-simple.info/forums/showthread...5#pid60125
Reply
(2017-09-19, 23:07:41)Carlos Wrote: See here: http://get-simple.info/forums/showthread...5#pid60125
 
Excellent - that did the trick nicely.

Code:
.nm_next_post {
 display:inline-block;
 float: left;
 text-transform: uppercase;
 color: #333;
 opacity:0.7;
 font-weight:600;
 font-size:0.7em;
}

Thanks again. That's me sorted out for a while. Keep up the great work !!!

C.
Reply
The thread is long and maybe I missed the post. I'm sorry if this is the case.

Is there any simple way how to wrap text around a post image on the page containing news excerpts, i.e. to align a post image to the left of text?

Karel
Reply
http://get-simple.info/forums/showthread...3#pid51743
Reply
(2017-09-25, 05:44:24)Carlos Wrote: http://get-simple.info/forums/showthread...3#pid51743

Many thanks for your quick help!
Reply
NM 3.5 beta available for testing
Reply
Carlos, I could not find this text to be able to translate it. http://prntscr.com/h0lux1
metatags work well
Reply
:-?
It's already translated in ru_RU.php
Code:
"NEW_POST"            =>  "Создать новую запись",
It could be that you have some $nm_i18n["NEW_POST"] definition in your gsconfig...

--

I suppose you mean the canonical meta tags. Thanks for reporting
Reply
indeed, it is, I added the parameters to gsconfig.php Smile
Reply
News Manager 3.5 available for download in Extend
Proper canonical meta tags for better SEO with new get_header replacement template tag, fixed integration with Multi-User plugin, etc.
See release notes
Reply
The ellipsis ("...") in numbered page navigation (available since NM 3.4) is not displayed (nor aligned) properly in Bootstrap - when set up as a "pagination" component in NM custom settings.

This will be fixed in next version. If anyone needs a patch, let me know.
Reply




Users browsing this thread: 2 Guest(s)
Free HDTV Channels Residential Solar Panels