定制 eighteen73/virtual-pages 二次开发

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

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

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-28