GetSimple Support Forum

Full Version: News Manager Sticky Post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am utilizing the News Manager for the front page of our Simple CMS site, and am curious if there is a way in order to make one of the news posts constantly be on the top of the posts and all subsequent news posts appear below it.

In this case, I made a news post about a high level free class we will be offering at an IT Conference we are hosting, and when we posted this to Facebook we got roughly 2100 hits in a day. I would like to make this news post stay at the top of my news post section on the site, but still be able to make new posts that will appear below it.

Does anyone know if this functionality is possible, and if so, how would I go about doing this?
Create a component e.g. sticky-post with this content (edit first lines to customize it):

Code:
<?php
$post = 'your-sticky-post-slug'; // <-- sticky post slug
$excerpt = true; // <-- false for full post
global $NMPAGEURL;
if (strval(get_page_slug(false))==$NMPAGEURL  && !isset($_GET['post']) && !isset($_GET['page']) && !isset($_GET['tag']) && !isset($_GET['archive']) && !isset($_GET['search']))
  nm_show_post($post,$excerpt);
?>

In your template, before <?php get_page_content(); ?>, insert:

Code:
<?php get_component('sticky-post'); ?>

That's it.

(It could be easily improved to insert the sticky post in a div with a class or id, so that it can be highlighted using styles.)
Thanks Carlos Smile

(2013-10-14, 04:12:18)Carlos Wrote: [ -> ]Create a component e.g. sticky-post with this content (edit first lines to customize it):

Code:
<?php
$post = 'your-sticky-post-slug'; // <-- sticky post slug
$excerpt = true; // <-- false for full post
global $NMPAGEURL;
if (strval(get_page_slug(false))==$NMPAGEURL  && !isset($_GET['post']) && !isset($_GET['page']) && !isset($_GET['tag']) && !isset($_GET['archive']) && !isset($_GET['search']))
  nm_show_post($post,$excerpt);
?>

In your template, before <?php get_page_content(); ?>, insert:

Code:
<?php get_component('sticky-post'); ?>

That's it.

(It could be easily improved to insert the sticky post in a div with a class or id, so that it can be highlighted using styles.)