Posts
Posts are where you create articles for your blog. Posts are powered by a blog_posts_model and have a grandparent class of MY_Model.
Post Fields
Below are the fields to fill out for a post:
- Title - The title of the post
- Content - The HTML content for the post
- Formatting - Formatting to apply to the content of the post. Options are Automatic (which uses CodeIgniter's auto_typography function), Markdown or None
- Excerpt - The excerpt of the post content to be displayed
- Permalink - The friendly URL to apply to the post
- Author - The author of the post
- Sticky - Determines whether to keep the article on the top pages. Gives a higher sorting precedence.
- Allow_comments - Allow comments for the post. Global setting for comments, allow_comments, must be set to 1
- Published - Determines whether to display the content
- Date added - The publish date the post
The Post Model Properties
The post model has the following properties:
- id
- title
- content
- content_filtered (stripped html)
- formatting
- excerpt
- permalink
- author_id
- sticky
- allow_comments
- date_added
- last_modified
- published (returns 'yes' or 'no')
The Post Model Properties and Methods
The post model has the following relationship properties:
- categories
- related_posts
- blocks
The post model has the following specific methods:
get_content_formatted(strip_images)
Gets the post content with the selected formatting settings applied. You can optionally strip all HTML tags from the excerpt.
get_excerpt_formatted(char_limit, '[readmore]')
Gets the post excerpt. The char_limit parameter will return only a certain character limit (if so, strip_tags is applied). The readmore parameter will be appended to the end of the excerpt with a link to the full post.
is_published()
Returns a boolean of whether the post is published
get_comments('[order]', [limit])
Returns an array of comment objects. Default order is date added in ascending order.
get_comments_count('[order]', [limit])
Returns the number of comments for the post Default order is date added in ascending order.
get_comments_formatted('[block]', [parent_id], [container_class])
Creates the HTML for the comments of the post using the comments block and properly nesting comments if their is a hierarchical structure.
get_categories('[order]')
Returns an array of category objects associated with the post Default ordering is by name in ascending order.
belongs_to_categoryget_tags_linked('[order]', '[join]')
Returns a string of category links. Default ordering is by name in ascending order. Default join parameter is ', '.
get_author()
Returns the author object.
get_url('full_path')
Returns the url of the post. The default for full_path is set to TRUE.
get_rss_date()
Returns an rss formatted date for the post.
get_atom_date()
Returns an atom formatted date for the post.
get_date_formatted('[format]')
Returns the date of the post. Takes a date format. Default is 'M d, Y'.
get_allow_comments()
Returns a boolean as to whether comments are allowed.
is_within_comment_time_limit()
Returns a boolean as to whether the current time is within the time limits specified by the post to comment.
get_prev_post()
Returns the previous post based on date.
get_prev_post_url()
Returns the previous post URL based on date.
get_next_post()
Returns the next post based on date.
get_next_post_url()
Returns the next post URL based on date.