regionhalland / region-halland-plugin-nav-menu-current-page-and-child-pages
前端插件,可返回WordPress菜单中的当前页面及其所有子页面
v1.1.0
2020-05-22 08:02 UTC
This package is auto-updated.
Last update: 2024-09-14 23:14:56 UTC
README
如何使用Region Hallands插件"RhNavMenuCurrentPageAndChildPages"
以下是如何使用"RhNavMenuCurrentPageAndChildPages"插件的说明。
应用范围
此插件创建一个数组,包含当前页面及其所有子页面从wp-menu
许可模型
此插件使用GPL-3.0许可模型。您可以通过附带的文件了解更多关于此许可模型的信息
LICENSE (https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhNavMenuCurrentPageAndChildPages?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 https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhNavMenuCurrentPageAndChildPages
通过composer导入插件
这些部分需要添加到您的composer文件中
存储库 = 插件存储的位置,在本例中是GitHub
"repositories": [
{
"type": "vcs",
"url": "https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhNavMenuCurrentPageAndChildPages"
},
],
要求 = 指定您想使用的插件版本,在本例中是版本1.0.0
注意!确保您获取的是最新版本。
"require": {
"regionhalland/region-halland-plugin-nav-menu-current-page-and-child-pages": "1.0.0"
},
通过"Blade"循环显示页面
@if(function_exists('get_region_halland_nav_menu_current_page_and_child_pages'))
@php($myMenu = get_region_halland_nav_menu_current_page_and_child_pages())
@if($myMenu['has-current-page'] == 1)
{{ $myMenu['current-page'] }}<br>
@endif
@if($myMenu['no-of-page-children'] > 0)
@foreach ($myMenu['page-children'] as $myChilds)
<a href="{{ $myChilds['url'] }}">
<span>{{ $myChilds['post_title'] }}</span><br>
</a>
@endforeach
@endif
@endif
数组的示例
array (size=4)
'has-current-page' => int 1
'current-page' => string 'Nam nunc justo' (length=14)
'no-of-page-children' => int 2
'page-children' =>
array (size=2)
0 =>
array (size=4)
'post_ID' => string '33' (length=2)
'post_title' => string 'Aliquam eros elit' (length=17)
'post_parent' => string '200' (length=3)
'url' => string 'http://dev-template.local/lorem-ipsum/aliquam-eros-elit/' (length=56)
1 =>
array (size=4)
'post_ID' => string '39' (length=2)
'post_title' => string 'Etiam pulvinar felis' (length=20)
'post_parent' => string '200' (length=3)
'url' => string 'http://dev-template.local/aldu-integer-id/etiam-pulvinar-felis/' (length=63)
版本历史
1.0.0
- 第一个版本,通过Packagist发布