定制 iamfredric/platon-theme 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

iamfredric/platon-theme

Composer 安装命令:

composer create-project iamfredric/platon-theme

包简介

Wordpress theme starter kit

README 文档

README

Platon is yet another framework that goes on top of Wordpress, heavily inspired by Laravel Platon makes Wordpress object oriented, with some smart automagic added to it.

Installation

  • composer create-project iamfredric/platon-theme your-path --stability=dev
  • Replace all occurances of [THEME_TITLE] with the title of your theme. (style.css + config/app.php)
  • Replace all occurances of [THEME_SLUG] with the slug of your theme. (style.css + config/app.php)

Routing

Normally, WordPress decides what template to render by looking at your file names.

In platon, this works. However, it's not the idea. Instead, there are a routes/web.php-file where we define routes.

The routes correspond with the wordpress template naming scheme.

<?php

use Platon\Facades\Route;

Route::register('front-page', [PageController::class, 'home']);
Route::register('page', [PageController::class, 'show']);

Route::register('index', [PostController::class, 'index']);
Route::register('single', [PostController::class, 'show']);

Route::register('single-project', [PostController::class, 'index']);

Controllers

Controllers are just a place to process the data before it hits the view-layer.

<?php

namespace App\Http\Controllers;

use App\Models\Page;

class PageController 
{
    public function show(Page $page): View
    {
        return view('pages.show', compact('page'));
    }
}

The page is resolved from the Container. This basically translates to:

$page = Page::current();

Models

The models are really just a wrapper for the WP_Post object.

It comes with some nice features.

For example, this is a post, the model name decides what the post type is.

class Post extends Model 
{}
<h1>{{ $post->title }}</h1>
<time datetime="{{ $post->created }}">
    Created at: {{ $post->created->format('j F Y') }}
</time>    

<div>
    {!! $post->content !!}
</div>   

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2022-08-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固