Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager (3.6) - Newslist Frontend Output
#1
Dear GS-Community,

I have a maybe simple question but couldn't figure it out of the "News manager" threads.

What I need is a customized output of the news-list, to wrap a surrounding div with custom CSS class, adding a "flex"-row etc.


Something like the
<?php nm_list_recent(); ?>
loop, but with  the excerpt and image.



The original loop:

Code:
<?php

global $NMPAGEURL, $NMRECENTPOSTS;
if ($NMPAGEURL == '') return;
$posts = nm_get_posts();
if (!empty($posts)) {
  echo '<ul class="nm_recent">',PHP_EOL;
  $posts = array_slice($posts, 0, $NMRECENTPOSTS, true);
  $posts = array_reverse($posts); // ascending date order
 

foreach ($posts as $post) {
   
    $url = nm_get_url('post') . $post->slug;
        $title = stripslashes($post->title);
        echo '  <li><a href="',$url,'">',$title,'</a></li>',PHP_EOL;
  }


  echo '</ul>',PHP_EOL;
}

?>


At the Moment I got this (works so far, is used as a component with "Dynpages"):

Code:
<?php

global $NMPAGEURL, $NMRECENTPOSTS;
if ($NMPAGEURL == '') return;
$posts = nm_get_posts();
if (!empty($posts)) {
         echo '<div class="posts">',PHP_EOL;

      $posts = array_slice($posts, 0, $NMRECENTPOSTS, true);
      $posts = array_reverse($posts); // ascending date order
 
foreach ($posts as $post) {
   
    $url = nm_get_url('post') . $post->slug;
        $title = stripslashes($post->title);
       $image = stripslashes($post->image);


    echo '  <article>
       <a href="',$url,'">',$title,'</a>  
      <span class="image object"><img src=" ',$image,' "> </span>
      <br> <br>
      <a href="',$url,'"><span class="more-link-style">weiterlesen ...</span></a>
             
   </article>',PHP_EOL;
  }

  echo '</div class="posts">',PHP_EOL;

}

?>


But I can't find out how to display the excerpt. I tried different lines of the "site.php" but all tests produced just blank fields.


It would be very helpful, if someone could add one (or more) example line(s).

Or does this need an extra function defined?


(I'm more into graphic-design, frontend-layout, CSS3 etc. and not so experienced in php)


Sorry for my rough english,

Best regards and many thanks!



(And many thanks for all the effort by the author to build the plugin)
Reply


Messages In This Thread
News Manager (3.6) - Newslist Frontend Output - by Holger - 2018-03-05, 13:13:38



Users browsing this thread: 1 Guest(s)