The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager Sticky Post
#1
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?
Reply
#2
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.)
Reply
#3
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.)
Reply




Users browsing this thread: 1 Guest(s)