miniCal
  • Quick Start
    • Introduction
  • miniCal Configuration
    • miniCal Hosted Service
    • Configure Feature Settings
    • Install Extensions
    • Create Multiple Properties
  • Local Installation
    • Local Installation
    • ENV Set-Up
    • Configuration Settings
    • Common Installations Errors
  • Contribution
    • Contribute to miniCal Core
  • Build an Extension
    • Build Your First Extension
      • Controllers
      • Assets
      • Config
      • language
      • Models
      • View
      • Helper
      • Library
      • Hooks
    • Open-source Extensions
    • Config Folder Files
      • Autoload File
      • Config File
      • Route File
    • miniCal Filters
    • miniCal Actions
    • Create Custom Hooks
    • Store Custom Data
      • POSTS
      • POSTMETA
      • OPTIONS
    • Composer Dependencies
  • Marketplace
    • miniCal Marketplace
  • Other resources
    • Overbooking for OTAs
    • miniCal Cron Setup
    • Automated Night Audit
    • Nginx Configuration
    • Docker Installation
    • Custom Domain Setup
  • Minical API Docs
    • API Documentation
  • Coming soon!
    • Access minical Data Using Helpers
      • Company Helper Functions
      • Customer Helper Functions
      • Booking Helper Functions
      • Rates Helper Functions
      • Rate Plan Helper Functions
      • Availability Helper Functions
      • Statement Helper Functions
      • Tax Helper Functions
      • Room Helper Functions
      • Charge Helper Functions
      • Payment Helper Functions
    • Access data in Extension
Powered by GitBook
On this page
  • Posts
  • Structure of the miniCal Post Table
  • Relationships Between Posts
  1. Build an Extension
  2. Store Custom Data

POSTS

Posts

  • A post is a content item stored in the posts table. Each has a post_type assigned to it, which could be an extension setting or user data for the extension page or something else.

  • All the data is stored in the Posts table and mapped with the company_id and user_id. Here are the important columns the Post table has.

Structure of the miniCal Post Table

  • post_title - can be a string like a description related to the post.

  • post_type - can be a string this can define the type of functionality.

  • post_status - can be a string (publish/unpublish) it determines whether the post is published or not.

  • post_date - the Date-Time of a post when created.

  • company_id - current company id (can get this from the session).

  • user_id - logged-in user id (can get this from the session).

// Create an post to the database
add_post($post);

// delete a post data. If the second parameter is true then
// the post is deleted permanently, default is false.
delete_post(int $post_id = null, bool $force_delete = false )

// get post form posts table.
get_post( $post );

// edit a post data of posts table
edit_post(array $post = null)

Relationships Between Posts

The post_parent the field is an important one, as it stores information about relationships between different posts. These include:

  • parent and child pages

  • revisions and the post they relate to

  • attachments and the post they were uploaded to

You can use the post_parent the field in various ways in your queries. For example, to query for child pages of a given page, you would use the following, where ID is the ID of the parent page:

'post_parent' => 'ID'

You could use a similar query to display attachments uploaded to a given post, or alternatively, you could query attachments with no parent (i.e. those uploaded directly to the media screen in the dashboard).

To do this, you would use the following argument:

'post_parent' => '0'
Method
Description
Parameters Description
Return value

add_post()

Adds a new post value.

add_post ($data) 1. array $data the data array of post.

null

get_post()

Get post value.

get_post( $post ) 1. mixed $post Int id of post or An Array of post data, this key will be added in where clause.

mixed Either array or null, if post data is available or no error occurs, then array else null.

edit_post()

Update post value.

edit_post(array $post = null) 1. array $post An Array of post data including post_id.

mixed Either post_id or null, if post data is updated or no error occurs, then id else null.

detele_post()

Detele post value.

delete_post(int $post_id = null, bool $force_delete = false ) 1. int $post_id The id of the post. 2. bool $force_delete flag to force delete a post, default is false..

mixed Either true or null, if postmeta data is delete then true else null.

PreviousStore Custom DataNextPOSTMETA

Last updated 3 years ago