regionhalland/region-halland-plugin-parent-category-page

获取当前分类/页面的父分类

v1.2.0 2020-06-02 06:51 UTC

This package is auto-updated.

Last update: 2024-09-29 05:42:41 UTC


README

如何使用Region Hallands的插件"RhParentCategoryPage"

以下是使用插件"RhParentCategoryPage"的说明。

应用范围

该插件用于获取当前分类/页面的父分类

许可模型

该插件使用GPL-3.0许可模型。您可以通过附带的文件了解更多关于此许可模型的信息

LICENSE (https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhParentCategoryPage?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/RhParentCategoryPage

通过composer导入插件

以下两部分需要添加到您的composer文件中

Repositories = 插件的存储位置,在本例中为github

"repositories": [
  {
    "type": "vcs",
    "url": "https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhParentCategoryPage"
  },
],

Require = 指定要使用的插件版本,在本例中为版本1.0.0

注意!请确保您获取的是最新版本。

"require": {
  "regionhalland/region-halland-plugin-parent-category-page": "1.0.0"
},

通过"Blade"显示父分类

@php($myParentPage = get_region_halland_parent_category_page())
@if($myParentPage['has_back'] == 1)
  <div>
    <p>
      <a href="{{$myParentPage['url']}}">{{$myParentPage['post_title']}}</a>
    </p>
  </div>
@endif

数组示例

array (size=3)
  'post_title' => string 'Kategori 1' (length=10)
  'url' => string 'http://dev-intra.local/category/kategori-1/' (length=43)
  'has_back' => int 1

版本历史

1.2.0

  • 修改了访问页面时的逻辑

1.1.0

  • 添加了通过Packagist发布的功能

1.0.0

  • 第一个版本