eighteen73/virtual-pages
Composer 安装命令:
composer require eighteen73/virtual-pages
包简介
A helper library for creating WordPress custom permalink pages. Based off https://gist.github.com/gmazzap/1efe17a8cb573e19c086
README 文档
README
Allows for creation of ad-hoc URLs from plugins, while following all standard WP page and content hooks.
Shortcodes can be included in content, allowing other code to be dynamically introduced where needed.
An example
<?php \Eighteen73\VirtualPages\VirtualPages::init(); add_action( 'virtual_pages', function ( \Eighteen73\VirtualPages\Controller $controller ) { // first page $controller->addPage( new \Eighteen73\VirtualPages\VirtualPage( "/custom/page" ) ) ->setTitle( 'My First Custom Page' ) ->setContent( '<p>Hey, this is my first custom virtual page!</p>' ) ->setTemplate( 'custom-page.php' ); // second page $controller->addPage( new \Eighteen73\VirtualPages\VirtualPage( "/my/custom/gallery" ) ) ->setTitle( 'My Custom Gallery Virtual Page' ) ->setContent( '[gallery ids="27,35,48"]' ) // is possible to put shortcodes in content ->setTemplate( 'custom-gallery.php' ); } );
Credits
Heavily based on https://gist.github.com/gmazzap/1efe17a8cb573e19c086 by Giuseppe Mazzapica.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-28