1. Go to this page and download the library: Download hokoo/wppostable library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hokoo / wppostable example snippets
use iTRON\wpPostAble\wpPostAble;
use iTRON\wpPostAble\wpPostAbleTrait;
use iTRON\wpPostAble\Exceptions\wppaCreatePostException;
use iTRON\wpPostAble\Exceptions\wppaLoadPostException;
class Item implements wpPostAble {
use wpPostAbleTrait;
const POST_TYPE = 'item';
}
/**
* @throws Exception\wppaLoadPostException
* @throws Exception\wppaCreatePostException
*/
public function __construct( int|null $post_id = null ) {
$this->wpPostAble( self::POST_TYPE, (int) $post_id );
// Do anything you need
}
$item = new Item();
$item = new Item( $post_id );
$item->setTitle('The best item');
$item->savePost();
$item->publish();
$item->setTitle('The best item')->publish();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.