PHP code example of hokoo / wppostable

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;
    
    class Item implements wpPostAble{
        use wpPostAbleTrait;
    }
    

      /**
       * @throws Exception\wppaLoadPostException
       * @throws Exception\wppaCreatePostException
       */
      public function __construct() {
         $this->wpPostAble( POST_TYPE, $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();