Topic: Number of total posts in blog

add to your blog.plugin.php:

/**
     * Get Blog Total Posts number
     *
     *  <code> 
     *      echo Blog::getTotalPosts();
     *  </code>
     *
     * @return string
     */
    public static function getTotalPosts() {

$posts = Pages::$pages->select('[parent="'.Blog::$parent_page_name.'" and status="published"]');

$count = count($posts); 

return  $count;

    }

add to your template:

<?php echo Blog::getTotalPosts(); ?>

it returns total number of published posts in blog

Re: Number of total posts in blog

@legmet

Nice snippet!

http://monstracreative.com - themes, plugins and snippets for monstra cms

:: ATTENTION ::
Need help? Login at your account at: http://monstracreative.com/users/login. -> You have a excellent support center at our website! wink