regionhalland / region-halland-plugin-page-children
前端插件,返回所有子页面
v1.8.0
2020-11-03 09:58 UTC
README
如何使用Region Halland的插件"RhPageChildren"
以下是如何使用插件"RhPageChildren"的说明。
使用范围
此插件创建一个包含所有子页面的数组
许可证模型
此插件使用许可证模型GPL-3.0。您可以通过随附的文件了解更多关于此许可证模型的信息
LICENSE (https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhPageChildren?path=%2FLICENSE&version=GBmaster)
安装和激活
A) Hämta pluginen via Git eller läs in det med Composer
B) Installera Region Hallands plugin i Wordpress plugin folder
C) Aktivera pluginet inifrån Wordpress admin
通过Git获取插件
git clone https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhPageChildren
通过composer加载插件
以下两个部分需要您添加到您的composer文件中
Repositories = 存储插件的位置,在此例中为github
"repositories": [
{
"type": "vcs",
"url": "https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhPageChildren"
},
],
Require = 指定您想使用的插件版本,在此例中为版本1.0.0
注意!请调整以获取最新版本。
"require": {
"regionhalland/region-halland-page-children": "1.0.0"
},
通过"Blade"循环页面
@if(function_exists('get_region_halland_page_children'))
@php($myPages = get_region_halland_page_children())
@if(isset($myPages))
@foreach ($myPages as $myChilds)
@if($myChilds['visible'] == 1)
<a href="{{ $myChilds['url'] }}">{{ $myChilds['post_title'] }}</a><br>
@endif
@endforeach
@endif
@endif
选择任意ID并通过"Blade"循环页面
@if(function_exists('get_region_halland_page_children'))
@php($myPages = get_region_halland_page_children(9))
@if(isset($myPages))
@foreach ($myPages as $myChilds)
@if($myChilds['visible'] == 1)
<a href="{{ $myChilds['url'] }}">{{ $myChilds['post_title'] }}</a><br>
@endif
@endforeach
@endif
@endif
数组的示例
array (size=6)
0 =>
array (size=9)
'post_id' => int 498
'post_title' => string 'Kulturområden' (length=14)
'current_page' => boolean false
'page_image' => string '' (length=0)
'page_image_url' => boolean false
'url' => string 'http://dev-regionhalland-nytt-tema.local/kultur/kulturomraden/' (length=62)
'template_name' => string 'default' (length=7)
'page_type' => string 'page' (length=4)
'is_external' => boolean false
1 =>
array (size=9)
'post_id' => int 234
'post_title' => string 'Regionalt kulturstöd' (length=21)
'current_page' => boolean false
'page_image' => string '' (length=0)
'page_image_url' => boolean false
'url' => string 'http://dev-regionhalland-nytt-tema.local/kultur/regionalt-kulturstod/' (length=69)
'template_name' => string 'default' (length=7)
'page_type' => string 'page' (length=4)
'is_external' => boolean false
2 =>
array (size=9)
'post_id' => int 405
'post_title' => string 'Kulturutveckling och samverkan' (length=30)
'current_page' => boolean false
'page_image' => string '' (length=0)
'page_image_url' => boolean false
'url' => string 'http://dev-regionhalland-nytt-tema.local/kultur/kulturutveckling/' (length=65)
'template_name' => string 'default' (length=7)
'page_type' => string 'page' (length=4)
'is_external' => boolean false
3 =>
array (size=9)
'post_id' => int 1577
'post_title' => string 'Kultur för barn och unga' (length=25)
'current_page' => boolean false
'page_image' => string '' (length=0)
'page_image_url' => boolean false
'url' => string 'http://dev-regionhalland-nytt-tema.local/kultur/kulturbarnunga/' (length=63)
'template_name' => string 'default' (length=7)
'page_type' => string 'page' (length=4)
'is_external' => boolean false
4 =>
array (size=9)
'post_id' => int 1571
'post_title' => string 'Kulturarrangemang' (length=17)
'current_page' => boolean false
'page_image' => string '' (length=0)
'page_image_url' => boolean false
'url' => string 'http://dev-regionhalland-nytt-tema.local/kultur/konst-och-kulturupplevelser/' (length=76)
'template_name' => string 'default' (length=7)
'page_type' => string 'page' (length=4)
'is_external' => boolean false
5 =>
array (size=9)
'post_id' => int 3272
'post_title' => string 'Kontakta oss som jobbar med kultur' (length=34)
'current_page' => boolean false
'page_image' => string '' (length=0)
'page_image_url' => boolean false
'url' => string 'http://dev-regionhalland-nytt-tema.local/kultur/kontakta-oss-som-jobbar-med-kultur/' (length=83)
'template_name' => string 'template-section.blade.php' (length=26)
'page_type' => string 'section' (length=7)
'is_external' => boolean false
版本历史
1.8.0
- 添加了section作为页面类型
1.7.0
- 参数以不返回隐藏的页面
- 可以返回通过Nested Pages创建的外部URL
1.6.0
- 重构输出以返回数组而不是对象
1.5.1
- 调整版本号
1.5.0
- 添加了"visible"字段,如果编辑器希望隐藏页面在菜单中
1.4.0
- 添加了通过Packagist发布的管道
1.3.0
- 附带了许可证模型文件
1.2.0
- 更新了许可证模型信息
- 添加了新的repo链接
1.1.0
- 为每个页面添加了image和image-url
- 添加了在调用函数时选择ID的功能
1.0.0
- 更新了composer文件
1.0.0
- 第一个版本