1. Go to this page and download the library: Download vincentts/wp-models 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/ */
vincentts / wp-models example snippets
namespace Models;
use Vincentts\WpModels\PostModel;
class Post extends PostModel {
protected $post_type = 'post';
}
namespace Models;
use Vincentts\WpModels\TermModel;
class Category extends TermModel {
protected $taxonomy = 'category';
}
namespace Models;
use Vincentts\WpModels\PostModel;
use Models\Category;
class Post extends PostModel {
protected $post_type = 'post';
public function categories() {
return $this->has( Category::class );
}
}
use Models\Post;
$posts = (new Post())->with(['categories'])->get();
use Models\Post;
$posts = (new Post())->meta(['summary', 'description'])->with(['categories'])->get();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.