This is the documentation for LemonStand V1, which has been discontinued. You can learn more and upgrade your store here.

LemonStand Version 1 Has Been Discontinued

This documentation is for LemonStand Version 1. LemonStand is now offered as a cloud-based eCommerce platform.
You can try the new LemonStand and learn about upgrading here.

Blog_Category class

The Blog_Category class represents a blog category. It contains fields for accessing a blog title title, description and posts.

Class fields

  • $name - category name
  • $url_name - URL name of the category, for example "news"
  • $description - a short description of the blog post in plain text format. Use the h() and nl2br() functions to output the description:
    <?= nl2br(h($category->description)) ?>
  • $code - the category API code
  • $published_post_num - number of published category posts
  • $posts - a list of published category posts. An instance of the Db_DataCollection class. Each element in the collection is an instance of the Blog_Post class.

Class methods

  • create() - creates an instance of the Blog_Category class.
  • find_all() - returns a collection of blog categories.
  • find($id) - finds a category by its identifier
  • find_by_code($api_code) - finds a category by its API code. Example:
    $category = Blog_Category::create()->find_by_code('news');

Next: Blog_Comment class
Previous: Blog_Post class
Return to Blog API