Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

mrDlef/morepress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Morepress

Stuff made easily on Wordpress.

Installation

composer require daidais/morepress

Features

Post

Create from id:

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

Create from \WP_Post:

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

Check if exists:

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

Get attribute:

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

Update post:

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

Add meta:

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

Update meta:

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

Get meta:

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

Delete meta:

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

Get time:

$mp_post->getTime();