Airship\Cabin\Hull\Landing\BlogPosts::listByTag PHP Method

listByTag() public method

List all of the blog posts for a given tag
public listByTag ( string $slug, string $page = '' )
$slug string
$page string
    public function listByTag(string $slug, string $page = '')
    {
        list($offset, $limit) = $this->getOffsetAndLimit($page);
        $tag = $this->blog->getTag($slug);
        $count = $this->blog->countByTag((int) $tag['tagid']);
        $blogRoll = $this->blog->listByTag((int) $tag['tagid'], $limit, $offset);
        $mathJAX = false;
        foreach ($blogRoll as $i => $blog) {
            $blogRoll[$i] = $this->blog->getSnippet($blog);
            if (Binary::safeStrlen($blogRoll[$i]['snippet']) !== Binary::safeStrlen($blog['body'])) {
                $blogRoll[$i]['snippet'] = \rtrim($blogRoll[$i]['snippet'], "\n");
            }
            $mathJAX = $mathJAX || \strpos($blog['body'], '$$') !== false;
        }
        $args = ['blogroll' => $blogRoll, 'pageTitle' => \__('Blog Posts Tagged "%s"', 'default', Util::noHTML($tag['name'])), 'mathjax' => $mathJAX, 'pagination' => ['base' => \Airship\LensFunctions\cabin_url() . 'blog/tag/' . $slug, 'count' => $count, 'page' => (int) \ceil($offset / ($limit ?? 1)) + 1, 'per_page' => $limit]];
        $this->config('blog.cachelists') ? $this->stasis('blog/tag', $args) : $this->lens('blog/tag', $args);
    }