Posts: 3,490
Threads: 106
Joined: Mar 2010
(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.
Posts: 3,490
Threads: 106
Joined: Mar 2010
(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
Posts: 39
Threads: 5
Joined: Oct 2013
(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.
C.
Posts: 39
Threads: 5
Joined: Oct 2013
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.
Posts: 3,490
Threads: 106
Joined: Mar 2010
(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
Posts: 39
Threads: 5
Joined: Oct 2013
2017-09-20, 04:17:32
(This post was last modified: 2017-09-20, 04:20:49 by carpman.
Edit Reason: added example
)
(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.
Posts: 2
Threads: 0
Joined: Sep 2017
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
Posts: 3,490
Threads: 106
Joined: Mar 2010
Posts: 2
Threads: 0
Joined: Sep 2017
(2017-09-25, 05:44:24)Carlos Wrote: http://get-simple.info/forums/showthread...3#pid51743
Many thanks for your quick help!
Posts: 3,490
Threads: 106
Joined: Mar 2010
NM 3.5 beta available for testing
Posts: 1,892
Threads: 82
Joined: Apr 2010
Carlos, I could not find this text to be able to translate it. http://prntscr.com/h0lux1
metatags work well
Posts: 3,490
Threads: 106
Joined: Mar 2010
:-?
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
Posts: 1,892
Threads: 82
Joined: Apr 2010
indeed, it is, I added the parameters to gsconfig.php
Posts: 3,490
Threads: 106
Joined: Mar 2010
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
Posts: 3,490
Threads: 106
Joined: Mar 2010
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.
Posts: 3,490
Threads: 106
Joined: Mar 2010
News Manager 3.6 available for download in Extend
New:
- meta description for posts
- date/time picker in edit post
Changes:
- fixed issue (proper display of ellipsis in Bootstrap's "pagination" for numbered navigation)
See release notes for more info.
Posts: 11
Threads: 0
Joined: Nov 2017
(2017-12-23, 22:06:59)Carlos Wrote: News Manager 3.6 available for download in Extend
New:
- meta description for posts
- date/time picker in edit post
Changes:
- fixed issue (proper display of ellipsis in Bootstrap's "pagination" for numbered navigation)
See release notes for more info.
Just started using News Manager and wanted to say thanks Carlos for this excellent plugin!
Posts: 1
Threads: 0
Joined: Feb 2017
2018-01-03, 06:19:35
(This post was last modified: 2018-01-03, 06:21:29 by Sevin.)
Hello, i don't know if it the solution already exists, but i have an idea. It would be useful to have a possibility to make a priority to news. Let's say default settings would be priority 1. My first article would be published on 5th of January and the second article on the 8th of January. But the first article from the 5th will be suddenly more important and i want to display it as first without changing the release date. So i will set up the priority on 2. It means every published article even with a more recent date will be displeyed under the article with priority 2. Is it possible to do it please?
Posts: 3,490
Threads: 106
Joined: Mar 2010
(2018-01-03, 06:19:35)Sevin Wrote: Hello, i don't know if it the solution already exists, but i have an idea. It would be useful to have a possibility to make a priority to news. Let's say default settings would be priority 1. My first article would be published on 5th of January and the second article on the 8th of January. But the first article from the 5th will be suddenly more important and i want to display it as first without changing the release date. So i will set up the priority on 2. It means every published article even with a more recent date will be displeyed under the article with priority 2. Is it possible to do it please?
Currently (since NM 3.4) I can think of a way to do something like that for the main news page (by using a "special" tag, a gsconfig setting and a bit of code in the template), but... those "high priority" posts wouldn't be displayed in month/year archives, neither listed by nm_list_recent() (unless you patch the plugin)
[edit] There's also the easy way: rendering those high priority posts (tagged with the "special" tag) in the news home page just before the normal posts. But if they are recent they would be displayed twice
Posts: 22
Threads: 1
Joined: Oct 2017
2018-01-14, 20:04:45
(This post was last modified: 2018-01-14, 20:10:53 by krlllo.)
I am sorry in advance if I am asking something stupid, but am still pretty newbie with GetSimple because I have been using it only for 5 months.
The question is: I would like to know if its possible to add on the side of any page where someone is reading an article, all the tags related to that post.
Like some websites says:Posts you may like
Thanks!
Posts: 3,490
Threads: 106
Joined: Mar 2010
Posts: 2
Threads: 0
Joined: Jan 2018
@Carlos, hello, I have great respect for your work. I have a big question that worries me very much.
About google adsense.
I know about existing plug-ins, adding ads using Special Pages -> DynPages.
But I would like to ask you for a simpler and more interesting option.
Is it possible to add the adsense code to your plugin automatically?
For example:
I have code, I insert it into one of the additional menus of your plugin, and then the plugin AUTOMATICALLY adds this code to all news feeds, for example after 300 ~ 400 characters.
I know, it sounds fantastic, but still, maybe it's possible? Thank you.
Posts: 2
Threads: 0
Joined: Jan 2018
@Carlos, Thank you for your attention. I also have a question about advertising in feeds. How is it possible to insert a block of adsense into this code so that it also happens to fall out randomly along with other blocks? Thank you.
Code: <?php nm_custom_display_random('
<section>
<div class="mini-posts">
<article class="mini-post">
<header>
<h3 align="justify"><a href="{{ post_link }}">{{ post_title }}</a></h3>
<time class="published" align="justify">{{ post_excerpt }}</time>
</header>
<a href="{{ post_link }}" class="image">{{ post_image }}</a>
</article>
</div>
</section>
'); ?>
The google adsense code is standard, for example:
Quote:<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-format="fluid"
data-ad-client=""
data-ad-slot=""
data-matched-content-ui-type="image_card_stacked"
data-matched-content-rows-num="1"
data-matched-content-columns-num="1"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
Posts: 3,490
Threads: 106
Joined: Mar 2010
(2018-01-21, 22:56:33)rokkybalbboa Wrote: @Carlos, hello, I have great respect for your work. I have a big question that worries me very much.
About google adsense.
I know about existing plug-ins, adding ads using Special Pages -> DynPages.
But I would like to ask you for a simpler and more interesting option.
Is it possible to add the adsense code to your plugin automatically?
For example:
I have code, I insert it into one of the additional menus of your plugin, and then the plugin AUTOMATICALLY adds this code to all news feeds, for example after 300 ~ 400 characters.
I know, it sounds fantastic, but still, maybe it's possible? Thank you.
I suppose it could be done by a plugin or function that parses the output of get_page_content() and inserts those codes.
It could work for normal pages, and also for News Manager lists of posts and single posts.
But... as far as I know, no one has developed something like that for GS.
Posts: 3,490
Threads: 106
Joined: Mar 2010
(2018-01-23, 02:10:27)rokkybalbboa Wrote: @Carlos, Thank you for your attention. I also have a question about advertising in feeds. How is it possible to insert a block of adsense into this code so that it also happens to fall out randomly along with other blocks? Thank you. [...]
Sorry, right now I cannot think of a way to do what you want without making modifications to the NM Addons plugin.
|