PHP code example of yuzuru-s / post-to-wp
1. Go to this page and download the library: Download yuzuru-s/post-to-wp 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/ */
yuzuru-s / post-to-wp example snippets
uzuruS\Wordpress\Post;
// endpoint → example.com
$wp = new Post(getenv(WP_USERNAME), getenv(WP_PASSWD), getenv(WP_ENDPOINT));
$res = $wp->makeCategories([
['name' => 'かて1', 'slug' => 'cate1'],
['name' => 'かて2', 'slug' => 'cate2'],
]);
$wp
->setTitle('たいとる')
->setDescription('本文')
->setKeywords(['key1','key2'])
->setCategories(['かて1','かて2'])
->setDate('2016-11-11')
->setWpSlug('entry')
->setThumbnail('https://www.pakutaso.com/shared/img/thumb/SAYA160312500I9A3721_TP_V.jpg')
->post();