Thread Rating:
  • 6 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager (updated)
The <head> section in your template.php file is the right place to put your code.

You could use something like:
Code:
<meta property="og:title" content="<?php nm_post_title() or get_page_clean_title(); ?> | <?php get_site_name(); ?>">
(Echoes the post title, or the page title if it's not a post.)
Reply
Still no luck :-(
Reply
@TrueWarrior

I'm a little bit late but I somehow didn't notice the pagination going further, so this is my tutorial... hope it helps... someone.


There are multiple ways ho to do it.

The inevitable part is getting the Share Button code from here. You can easily generate it and customize it appearance.

Then you have to paste the code somewhere
  • Option 1 - bad solution - paste the code your posts' template in /plugins/news_manager/inc/site.php, that's where you find the template for your posts; but I don't really recommend this way - it's hardcoding, you have to do it again with each update of News Manager
  • Option 2 - using components, a bit more complicated for the first look, but it's actually not, it's the best solution you can easily manage yourself Smile follow these few simple steps
  • Go to your News Manager settings in the backend, allow custom settings and write there
    Code:
    single componentbottompost author_social
  • Still in the backend, go to Theme => Edit components
  • Create a new component called "author_social" and paste there the code you generated in the first step

Btw, you can name the component anyhow you want, but it has to match the name given in News Manager settings, my choice was "author_social". I use multiple share buttons (twitter, g+, fb share and like) there. If you wanted to have the same share buttons as I do, just paste into the "author_social" component a little bit more of code you can also generate somewhere on the internet, this is the code I use:
Code:
<div id="sharing">
  <div id="facebook">
    <!-- Facebook Sharing -->
    <div id="fb-root"></div>
    <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <div class="fb-like" data-href="<?php nm_post_url(); ?>" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>
    <div class="fb-share-button" data-href="<?php nm_post_url(); ?>" data-type="button"></div>
  </div>
  <div id="twitter">
    <!-- Twitter Sharing -->
    <a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
  </div>
  <div id="google">    
    <!-- Google+ Sharing -->
    <div class="g-plus" data-action="share" data-annotation="bubble"></div>
    <script type="text/javascript">
      window.___gcfg = {lang: 'en-GB'};
      (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/platform.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
      })();
    </script>
  </div>
</div>

This is how it looks with a little bit of styling
[Image: B2t5D.jpg]
Feel free to check News Manager posts on my website in my signature below.

Good luck Smile
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
(2015-01-28, 03:19:41)TeeJay Wrote: @TrueWarrior

I'm a little bit late but I somehow didn't notice the pagination going further, so this is my tutorial... hope it helps... someone.


There are multiple ways ho to do it.

The inevitable part is getting the Share Button code from here. You can easily generate it and customize it appearance.

Then you have to paste the code somewhere
  • Option 1 - bad solution - paste the code your posts' template in /plugins/news_manager/inc/site.php, that's where you find the template for your posts; but I don't really recommend this way - it's hardcoding, you have to do it again with each update of News Manager
  • Option 2 - using components, a bit more complicated for the first look, but it's actually not, it's the best solution you can easily manage yourself Smile follow these few simple steps
  • Go to your News Manager settings in the backend, allow custom settings and write there
    Code:
    single componentbottompost author_social
  • Still in the backend, go to Theme => Edit components
  • Create a new component called "author_social" and paste there the code you generated in the first step

Btw, you can name the component anyhow you want, but it has to match the name given in News Manager settings, my choice was "author_social". I use multiple share buttons (twitter, g+, fb share and like) there. If you wanted to have the same share buttons as I do, just paste into the "author_social" component a little bit more of code you can also generate somewhere on the internet, this is the code I use:
Code:
<div id="sharing">
  <div id="facebook">
    <!-- Facebook Sharing -->
    <div id="fb-root"></div>
    <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <div class="fb-like" data-href="<?php nm_post_url(); ?>" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>
    <div class="fb-share-button" data-href="<?php nm_post_url(); ?>" data-type="button"></div>
  </div>
  <div id="twitter">
    <!-- Twitter Sharing -->
    <a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
  </div>
  <div id="google">    
    <!-- Google+ Sharing -->
    <div class="g-plus" data-action="share" data-annotation="bubble"></div>
    <script type="text/javascript">
      window.___gcfg = {lang: 'en-GB'};
      (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/platform.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
      })();
    </script>
  </div>
</div>

This is how it looks with a little bit of styling
[Image: B2t5D.jpg]
Feel free to check News Manager posts on my website in my signature below.

Good luck Smile

Well the problem is not with placing buttons, problem is in that they dont share proper content - after clicking share it should share post name, image and post content and in my case it only share main site content
Reply
Then just add open graph meta tags into your head with proper content.

This is how I do it:
Code:
<?php
global $pageURL;

$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
?>

<meta property="og:locale" content="cs_CZ">
<meta property="og:site_name" content="<?php get_site_name(); ?>">
<?php if (nm_post_has_image()) { ?>
<meta property="og:image" content="<?php nm_post_image_url(900,471,1); ?>">
<?php } ?>  
<meta property="og:image" content="<?php get_theme_url(); ?>/images/facebook-300-300.png">    
<meta property="og:title" content="<?php if (nm_is_single()) { nm_post_title(); ?> | <?php get_site_name(); } else { echo(get_custom_title_tag()); }?>">
<meta property="og:description" content="<?php nm_post_excerpt(225) or get_page_excerpt(225); ?>">
<meta property="og:type" content="website">
<meta property="og:url" content="<?php echo $pageURL; ?>">
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
(2015-01-28, 21:13:17)TeeJay Wrote:
(2015-01-28, 17:20:52)TrueWarrior Wrote: Well the problem is not with placing buttons, problem is in that they dont share proper content - after clicking share it should share post name, image and post content and in my case it only share main site content

Then just add open graph meta tags into your head with proper content.

This is how I do it:
Code:
<?php
global $pageURL;

$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
?>

<meta property="og:locale" content="cs_CZ">
<meta property="og:site_name" content="<?php get_site_name(); ?>">
<?php if (nm_post_has_image()) { ?>
<meta property="og:image" content="<?php nm_post_image_url(900,471,1); ?>">
<?php } ?>  
<meta property="og:image" content="<?php get_theme_url(); ?>/images/facebook-300-300.png">    
<meta property="og:title" content="<?php if (nm_is_single()) { nm_post_title(); ?> | <?php get_site_name(); } else { echo(get_custom_title_tag()); }?>">
<meta property="og:description" content="<?php nm_post_excerpt(225) or get_page_excerpt(225); ?>">
<meta property="og:type" content="website">
<meta property="og:url" content="<?php echo $pageURL; ?>">
after adding this to my page it wont load and go just blank o O
you can se this here http://truewarriors.eu/getsimple/
Reply
Sorry, I got the problem now.
In fact I'm also using Custom Title plugin and I guess your not, so you're basically calling an undefined function get_custom_title_tag() which makes your page go blank.

Therefore, you have to do either of these things:
  1. install the plugin, or
  2. replace the og:title row with what Carlos suggested
    Code:
    <meta property="og:title" content="<?php nm_post_title() or get_page_clean_title(); ?> | <?php get_site_name(); ?>">
It should make everything okay Smile
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
(2015-01-29, 20:34:57)TeeJay Wrote:
(2015-01-29, 19:09:32)TrueWarrior Wrote: after adding this to my page it wont load and go just blank o O
you can se this here http://truewarriors.eu/getsimple/

Sorry, I got the problem now.
In fact I'm also using Custom Title plugin and I guess your not, so you're basically calling an undefined function get_custom_title_tag() which makes your page go blank.

Therefore, you have to do either of these things:
  1. install the plugin, or
  2. replace the og:title row with what Carlos suggested
    Code:
    <meta property="og:title" content="<?php nm_post_title() or get_page_clean_title(); ?> | <?php get_site_name(); ?>">
It should make everything okay Smile
Tried both ways, now i have plugin installed but results are the same.
Nothing is gathered to Facebook share: post title, content etc

i'm sorry for taking your time
Reply
You have an extra <HEAD> section (with empty meta properties) before the start of the html document. Take a look at your page's source code. Maybe it's failing because of that. Anyway, it's incorrect.
Reply
(2015-01-30, 00:37:18)Carlos Wrote: You have an extra <HEAD> section (with empty meta properties) before the start of the html document. Take a look at your page's source code. Maybe it's failing because of that. Anyway, it's incorrect.

Yes it was doubled, but after fixing this, still not work :-(.
Strange thing is when i check page source there are og tags with proper content but its like share button don't get content from them.
Reply
Your HTML is still messed up a lil bit (more) Smile

Check your source code via Firefox or Chrome and you'll see for yourself.
This is a screenshot for you showing a part of the problem http://i.snag.gy/PjRDq.jpg.

Also I can recommend you using W3C Validator, you'll see a bunch of errors that you should get rid of. For instance, see here.

You cannot have any content element in your head (like the calendar) as that immediately closes the head tag and the rest of your meta tags is lost right away.
Just to give you a hint where to start - you can see that in the middle of your og:description tag, you're starting a CSS link! You just can't do that, man Smile
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
(2015-01-30, 05:18:52)TeeJay Wrote: Your HTML is still messed up a lil bit (more) Smile

Check your source code via Firefox or Chrome and you'll see for yourself.
This is a screenshot for you showing a part of the problem http://i.snag.gy/PjRDq.jpg.

Also I can recommend you using W3C Validator, you'll see a bunch of errors that you should get rid of. For instance, see here.

You cannot have any content element in your head (like the calendar) as that immediately closes the head tag and the rest of your meta tags is lost right away.
Just to give you a hint where to start - you can see that in the middle of your og:description tag, you're starting a CSS link! You just can't do that, man Smile

woah i wasn't checking calendar page for long time and last time was fine.
Thanks !!! i will use w3c validator and fix those things. Hope it will help.
Reply
Well i cleanup those errors but it is not the case, share button still don't work and doesn't get post content to sharing i think i give up Sad
Reply
I don't want to offend your opinion but I've just tried sharing your Post 1 manually and then via the share button and it works flawlessly in both cases :)
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
any way to make categories in nm like gs blog
nm fast and simple with image and no need to upload a thumbnail

Cheers
Reply
(2015-02-02, 17:10:10)Roamer Wrote: any way to make categories in nm like gs blog
nm fast and simple with image and no need to upload a thumbnail

Currently there's no way to have categories. An alternative is using tags.
Reply
When do the news manager start paginating the news list? I've posted about 30 news items so far.
Reply
(2015-02-03, 19:56:02)domscatterbrain Wrote: When do the news manager start paginating the news list? I've posted about 30 news items so far.

News Manager -> Settings -> Number of posts on News Page:
(enter the maximum number of posts per page there)
Reply
News Manager 3.1 beta 25 available for testing.

- Several more issues fixed.
- Tag pages now included in Sitemap
- Custom classes for html elements (@Oleg06)
- Somewhat customizable navigation (markup, classes)

Feedback much appreciated, as always.

I think I will not add any more features for 3.1 (leaving some stuff for 3.2)
Reply
Is there anyway to get post excerpt to display only on the front page like a description while not displayed in single post view ?

also is customising the layout done in site.php ?


Cheers
Reply
(2015-02-08, 07:45:08)Roamer Wrote: Is there anyway to get post excerpt to display only on the front page like a description while not displayed in single post view ?

You can select Full Text or Excerpt in News Manager Settings.

(2015-02-08, 07:45:08)Roamer Wrote: also is customising the layout done in site.php ?

You can somewhat customize the posts layout (markup, fields order, etc.), see "Custom Settings" and "Posts layout" here.

(version 3.1 will have some more custom settings to customize classes)
Reply
Hey guys,

I'm new to get-simple and recently started to created a first website using GS.

I would like to know if it's possible to add tags as an additional class to the nm_post item. For example, if you going to create a new post and set the tag "foo", the rendered output looks something like this <div class="nm_post foo">.

Is this somehow possible?
Reply
(2015-02-12, 06:40:40)revotron Wrote: I would like to know if it's possible to add tags as an additional class to the nm_post item. For example, if you going to create a new post and set the tag "foo", the rendered output looks something like this <div class="nm_post foo">.

Is this somehow possible?

Not currently possible.

Just curious, do you need this for the single/full post view only, or also for lists of posts (main news page, archives, etc)?
If a post had tags "foo, bar", would you need to have classes for both tags, or just for the first one?
Reply
(2015-02-12, 08:26:07)Carlos Wrote:
(2015-02-12, 06:40:40)revotron Wrote: I would like to know if it's possible to add tags as an additional class to the nm_post item. For example, if you going to create a new post and set the tag "foo", the rendered output looks something like this <div class="nm_post foo">.

Is this somehow possible?

Not currently possible.

Just curious, do you need this for the single/full post view only, or also for lists of posts (main news page, archives, etc)?
If a post had tags "foo, bar", would you need to have classes for both tags, or just for the first one?


I would like to display all news items one one page. There are three categories (or tags) and you can filter the news by tag by clicking on buttons, something similar like the isotope filter.

So basically I have to touch the code of the plug-in and change it to my needs. Is there any good practice to change an existing plug-in with Get Simple?

Alternatively I just could write some JS for those functionality and manipulate the DOM on client site. But I think this may be too much and doesn't feel right for such core features as having the tag as a class name.
It should be a class for all tags set.
Reply
Here's a patch for NM 3.0. Edit news_manager/inc/site.php, find this:

Code:
echo '  <',$nmoption['markuppost'],' class="nm_post';
    if ($single) echo ' nm_post_single';
    echo '">',PHP_EOL;

and replace it by:

Code:
echo '  <',$nmoption['markuppost'],' class="nm_post';
    if ($single) echo ' nm_post_single';
    // patch - tag classes
    foreach ($tags as $tag)
      if (substr($tag, 0, 1) != '_')
        echo ' nm_tag_'.htmlspecialchars($tag);
    // end patch
    echo '">',PHP_EOL;

This should generate additional classes nm_tag_foo, nm_tag_bar, ... in the post container.

Of course you will have to re-do the patch when you upgrade.
This part of the code will be changed in NM 3.1, so the patch would be a bit different.

In some future version this will be possible without patches, when some kind of post templating is implemented.
Reply




Users browsing this thread: 17 Guest(s)