Add blog
This commit is contained in:
parent
458443864b
commit
10a60f7c5d
2 changed files with 62 additions and 5 deletions
|
@ -9,11 +9,12 @@ namespace wishthis;
|
|||
enum Navigation: int
|
||||
{
|
||||
case Wishlists = 1;
|
||||
case System = 2;
|
||||
case Settings = 3;
|
||||
case Account = 4;
|
||||
case Login = 5;
|
||||
case Register = 6;
|
||||
case Blog = 2;
|
||||
case System = 3;
|
||||
case Settings = 4;
|
||||
case Account = 5;
|
||||
case Login = 6;
|
||||
case Register = 7;
|
||||
}
|
||||
|
||||
class Page
|
||||
|
@ -120,6 +121,7 @@ class Page
|
|||
|
||||
$ignorePower = array(
|
||||
'home',
|
||||
'blog',
|
||||
'install',
|
||||
'login',
|
||||
'maintenance',
|
||||
|
@ -439,6 +441,7 @@ class Page
|
|||
$user = new User();
|
||||
|
||||
$wishlists = Navigation::Wishlists->value;
|
||||
$blog = Navigation::Blog->value;
|
||||
$system = Navigation::System->value;
|
||||
$settings = Navigation::Settings->value;
|
||||
$account = Navigation::Account->value;
|
||||
|
@ -446,6 +449,17 @@ class Page
|
|||
$register = Navigation::Register->value;
|
||||
|
||||
$pages = array(
|
||||
$pages[$blog] = array(
|
||||
'text' => __('Blog'),
|
||||
'alignment' => 'left',
|
||||
'items' => array(
|
||||
array(
|
||||
'text' => __('Blog'),
|
||||
'url' => '/?page=blog',
|
||||
'icon' => 'blog',
|
||||
),
|
||||
),
|
||||
),
|
||||
$system => array(
|
||||
'text' => __('System'),
|
||||
'icon' => 'wrench',
|
||||
|
|
43
src/pages/blog.php
Normal file
43
src/pages/blog.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* home.php
|
||||
*
|
||||
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||
*/
|
||||
|
||||
namespace wishthis;
|
||||
|
||||
$page = new Page(__FILE__, __('Blog'));
|
||||
$page->header();
|
||||
$page->bodyStart();
|
||||
$page->navigation();
|
||||
|
||||
$posts_remote = file_get_contents('https://wishthis.online/src/blog/wp-json/wp/v2/posts');
|
||||
$posts = array();
|
||||
|
||||
if (false !== $posts_remote) {
|
||||
$posts = json_decode($posts_remote);
|
||||
}
|
||||
?>
|
||||
|
||||
<main>
|
||||
<div class="ui container">
|
||||
<h1 class="ui header"><?= $page->title ?></h1>
|
||||
|
||||
<?= $page->messages() ?>
|
||||
|
||||
<?php foreach ($posts as $post) { ?>
|
||||
<div class="ui segment">
|
||||
<h2 class="ui header"><?= $post->title->rendered ?></h2>
|
||||
|
||||
<div><?= $post->content->rendered ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<?php
|
||||
$page->footer();
|
||||
$page->bodyEnd();
|
||||
?>
|
Loading…
Reference in a new issue