PHP code example of daidais / morepress

1. Go to this page and download the library: Download daidais/morepress 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/ */

    

daidais / morepress example snippets


$mp_post = new \Morepress\Post(23);

global $post;
$mp_post = new \Morepress\Post($post);

if($mp_post->exists())
{
    // Do stuff
}

$mp_post->ID;
$mp_post->post_name;
// etc.

$mp_post->update(array(
    'post_status' => 'publish',
));

$mp_post->addMeta('meta_key', 'meta_value', true);

$mp_post->updateMeta('meta_key', 'meta_value', 'prev_meta_value')

$mp_post->getMeta('meta_key', true);

$mp_post->deleteMeta('meta_key', 'meta_value');

$mp_post->getTime();