[WordPress] 外掛分享: Just Post Preview Widget

首頁外掛目錄 › Just Post Preview Widget
WordPress 外掛 Just Post Preview Widget 的封面圖片
10+
安裝啟用
★★★★★
5/5 分(1 則評價)
3300 天前
最後更新
問題解決
WordPress 4.0+ v1.1.1 上架:2015-10-28

內容簡介

這個外掛是為了讓開發人員可以輕鬆編輯複雜的版面配置,並在版面配置內插入不同的文章標題方塊,以及應用在側邊欄或頁面建構器上。預設提供了3種預定義的版面配置,你可以在你的主題中重新編寫它們或註冊自定義配置。

不幸的是,預定義的版面配置內沒有樣式。 (因為它們無論如何都會在主題中被完全覆蓋)

範本檔案

要覆寫預定義的範本,你應該在你主題的根目錄中創建一個名為“just-post-preview”的文件夾,並從/wp-content/plugins/just-post-preview/layouts/文件夾中複製所需的範本。

檔案名稱格式:jpp_layout_{layout key}.php

在演示範本的頂端,你可以找到PHP註釋。它們可以幫你的集成開發環境顯示可用變數的自動完成選單。

添加自定義版面配置

要添加自定義版面配置,你需要在你的主題functions.php文件中添加一個新的過濾器鉤子:

add_filter('jpp_post_preview_layouts', 'my_post_preview_layouts');
function my_post_preview_layouts($layouts){
$layouts['my_layout_key'] = 'My custom layout';
return $layouts;
}

在鉤子之後,你需要在/path/to/theme/just-post-preview文件夾中創建一個名為jpp_layout_my_layout_key.php的範本檔案。

就是這樣!

如果你發現任何錯誤或問題,請隨時聯繫我!

問題追蹤器
這個專案也可以在 GitHub 上找到。請在那裡發布你的問題或反饋。
https://github.com/aprokopenko/just-post-preview

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.1.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Just Post Preview Widget」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin is for developers who need easy to edit the complex layouts and insert different post tile blocks inside the layout,
sidebars or page builders. By default, it has 3 pre-defined layouts; you can rewrite them in your theme or register custom layouts.
Unfortunately the pre-defined layouts have no styles inside. (Because they will be overwritten in the theme 100% anyway).
Template files
To overwrite the pre-defined templates, you should create a folder with the name “just-post-preview” in the root
of your theme and copy required templates from the /wp-content/plugins/just-post-preview/layous/ folder.
File names format: jpp_layout_{layout key}.php
You can find PHP comments on the top of the demo templates. They help your IDE to show you autocomplete boxes for available variables.
Adding custom layout
To add a custom layout, you need to add a new filter hook in your theme functions.php file:
add_filter('jpp_post_preview_layouts', 'my_post_preview_layouts');
function my_post_preview_layouts($layouts){
$layouts['my_layout_key'] = 'My custom layout';
return $layouts;
}

After that hook you will need to create a template file in the /path/to/theme/just-post-preview folder with the name jpp_layout_my_layout_key.php.
That’s all!
FILL FREE TO CONTACT ME IF YOU FIND ANY BUGS/ISSUES!
ISSUES TRACKER
The project is also available on github. Please post your issues or feedbacks there.
https://github.com/aprokopenko/just-post-preview

延伸相關外掛

文章
Filter
Apply Filters
Mastodon