regionhalland/region-halland-plugin-acf-page-kulturprogram

显示文化节目

v2.18.0 2022-04-07 11:19 UTC

README

如何使用Region Hallands插件"RhAcfPageKulturProgram"

以下是如何使用插件"RhAcfPageKulturProgram"的说明。

使用范围

此插件提供创建文化事件帖子的功能

OBS!单独的帖子在“single-kulturprogram.blade.php”页面上显示 OBS!帖子列表在“archive-kulturprogram.blade.php”页面上显示

这两个文件都包含在“views”文件夹中

许可模型

此插件使用GPL-3.0许可模型。您可以阅读关于此许可模型的相关文件以了解更多信息

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

通过composer导入插件

这些部分需要您添加到composer文件中

存储库 = 插件存储的位置,在此例中为github

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

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

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

"require": {
  "regionhalland/region-halland-acf-page-kulturprogram": "1.0.0"
},

通过"Blade"在一个页面上显示所有内容

<ol>
  <li>
      Typ:
      @php($arrLabels = get_region_halland_acf_page_kulturprogram_type_labels())  
      @if(isset($arrLabels))
        @foreach ($arrLabels as $label)
          {{ $label['label'] }}, 
        @endforeach
      @endif
  </li>
  <li>Målgrupp: {{ get_region_halland_acf_page_kulturprogram_malgrupp() }}</li>
  <li>Publik: {{ get_region_halland_acf_page_kulturprogram_publik() }}</li>
  <li>Längd: {{ get_region_halland_acf_page_kulturprogram_langd() }}</li>
  <li>Lokal: {{ get_region_halland_acf_page_kulturprogram_lokal() }}</li>
  <li>Turnéperiod: {{ get_region_halland_acf_page_kulturprogram_turne_period() }}</li>
  <li>Pris: {{ get_region_halland_acf_page_kulturprogram_pris() }}</li>
</ol>

通过"Blade"在一个页面上列出所有内容

  • OBS!默认情况下会列出所有内容,但您可以在调用函数时指定任意数量。
@php($myItems = get_region_halland_acf_page_kulturprogram_items())
@foreach($myItems as $item)
  <h2>{{ $item->post_title }}</h2><br>
  <span>{{ $item->post_content }}</span><br><br>
  <span>
    <strong>Typ:</strong>
    @foreach($item->labels as $label)
      {{ $label['label'] }}
    @endforeach
  </span><br>
  <span><strong>Målgrupp:</strong> {{ $item->malgrupp }}</span><br>
  <span><strong>Publik:</strong> {{ $item->publik }}</span><br>
  <span><strong>Speltid:</strong> {{ $item->speltid }}</span><br>
  <span><strong>Lokal:</strong> {{ $item->lokal }}</span><br>
  <span><strong>Period:</strong> {{ $item->period }}</span><br>
  <span><strong>Pris:</strong> {{ $item->pris }}</span><br><br><br>
@endforeach

数组示例

array (size=3)
  0 => 
    object(WP_Post)[6655]
      public 'ID' => int 736
      public 'post_author' => string '11' (length=2)
      public 'post_date' => string '2019-02-15 14:03:26' (length=19)
      public 'post_date_gmt' => string '2019-02-15 14:03:26' (length=19)
      public 'post_content' => string 'En dansclownföreställning för barn i åldern 6-10 år' (length=51)
      public 'post_title' => string 'Extrem(is)t Kul - En dansclownföreställning' (length=45)
      public 'post_excerpt' => string '' (length=0)
      public 'post_status' => string 'publish' (length=7)
      public 'comment_status' => string 'closed' (length=6)
      public 'ping_status' => string 'closed' (length=6)
      public 'post_password' => string '' (length=0)
      public 'post_name' => string 'extremist-kul-en-clowndansforestallning' (length=39)
      public 'to_ping' => string '' (length=0)
      public 'pinged' => string '' (length=0)
      public 'post_modified' => string '2019-03-13 13:43:36' (length=19)
      public 'post_modified_gmt' => string '2019-03-13 13:43:36' (length=19)
      public 'post_content_filtered' => string '' (length=0)
      public 'post_parent' => int 0
      public 'guid' => string 'http://exempel.se/?post_type=kulturprogram&#038;p=736' (length=53)
      public 'menu_order' => int 0
      public 'post_type' => string 'kulturprogram' (length=13)
      public 'post_mime_type' => string '' (length=0)
      public 'comment_count' => string '0' (length=1)
      public 'filter' => string 'raw' (length=3)
      public 'url' => string 'http://exempel.se/kulturprogram/extremist-kul-en-clowndansforestallning/' (length=72)
      public 'image' => string '' (length=0)
      public 'image_url' => boolean false
      public 'date' => string '2019-02-15' (length=10)
      public 'labels' => 
        array (size=2)
          0 => 
            array (size=1)
              'label' => string 'Dans' (length=4)
          1 => 
            array (size=1)
              'label' => string 'Film' (length=4)
      public 'malgrupp' => string '6–10 år' (length=10)
      public 'publik' => string '70 pers inkl. personal' (length=22)
      public 'speltid' => string '45 min' (length=6)
      public 'lokal' => string 'Spelyta exkl. sittplatser: 6x8x2,5m' (length=35)
      public 'period' => string 'Enligt överenskommelse.' (length=24)
      public 'pris' => string 'Pris i Halland: 1:a föreställningen: 1500 kr' (length=45)
  1 => 
    object(WP_Post)[6659]
      public 'ID' => int 608
      public 'post_author' => string '1' (length=1)
      public 'post_date' => string '2019-02-13 15:54:27' (length=19)
      public 'post_date_gmt' => string '2019-02-13 15:54:27' (length=19)
      public 'post_content' => string 'Lär dig att jonglera med både bollar och käglor' (length=47)
      public 'post_title' => string 'Lär dig jonglera' (length=16)
      public 'post_excerpt' => string '' (length=0)
      public 'post_status' => string 'publish' (length=7)
      public 'comment_status' => string 'closed' (length=6)
      public 'ping_status' => string 'closed' (length=6)
      public 'post_password' => string '' (length=0)
      public 'post_name' => string 'lar-dig-jonglera' (length=16)
      public 'to_ping' => string '' (length=0)
      public 'pinged' => string '' (length=0)
      public 'post_modified' => string '2019-03-13 13:44:16' (length=19)
      public 'post_modified_gmt' => string '2019-03-13 13:44:16' (length=19)
      public 'post_content_filtered' => string '' (length=0)
      public 'post_parent' => int 0
      public 'guid' => string 'http://exempel.se/?post_type=kulturprogram&#038;p=608' (length=53)
      public 'menu_order' => int 0
      public 'post_type' => string 'kulturprogram' (length=13)
      public 'post_mime_type' => string '' (length=0)
      public 'comment_count' => string '0' (length=1)
      public 'filter' => string 'raw' (length=3)
      public 'url' => string 'http://exempel.se/kulturprogram/lar-dig-jonglera/' (length=50)
      public 'image' => string '' (length=0)
      public 'image_url' => boolean false
      public 'date' => string '2019-02-13' (length=10)
      public 'labels' => 
        array (size=2)
          0 => 
            array (size=1)
              'label' => string 'Konst' (length=5)
          1 => 
            array (size=1)
              'label' => string 'Kulturarv' (length=9)
      public 'malgrupp' => string 'Både vuxna och barn' (length=20)
      public 'publik' => string 'Hela familjen är välkommen!' (length=29)
      public 'speltid' => string '120 minuter' (length=11)
      public 'lokal' => string 'Stora hallen' (length=12)
      public 'period' => string 'Under mars månad' (length=17)
      public 'pris' => string '120 kronor' (length=10)

通过"Blade"为单个标签数组提供特殊处理

  • OBS!每个标签都有一个数组,即舞蹈、电影、艺术、文化遗产、音乐、手工艺和戏剧。以下为舞蹈数组的示例。其他功能相同。请注意,手工艺数组的拼写为slojd
<h3>Dans</h3>
@foreach($myItems['dans'] as $item)
  <li>
    <p><a href="{{ $item['page']->url }}">{{ $item['page']->post_title }}</a></p>
    <p><strong>Målgrupp:</strong> {{ $item['page']->malgrupp }}</p>
  </li>
@endforeach

特殊列表数组示例

array (size=2)
  0 => 
    array (size=1)
      'page' => 
        object(WP_Post)[6653]
          public 'ID' => int 3621
          public 'post_author' => string '21' (length=2)
          public 'post_date' => string '2019-03-25 15:50:43' (length=19)
          public 'post_date_gmt' => string '2019-03-25 15:50:43' (length=19)
          public 'post_content' => string 'Ett ovanligt dansäventyr på en helt vanlig lekplats' (length=51)
          public 'post_title' => string 'The Playground (2–6 år)' (length=26)
          public 'post_excerpt' => string '' (length=0)
          public 'post_status' => string 'publish' (length=7)
          public 'comment_status' => string 'closed' (length=6)
          public 'ping_status' => string 'closed' (length=6)
          public 'post_password' => string '' (length=0)
          public 'post_name' => string 'the-playground-2-6-ar' (length=21)
          public 'to_ping' => string '' (length=0)
          public 'pinged' => string '' (length=0)
          public 'post_modified' => string '2019-03-25 15:50:43' (length=19)
          public 'post_modified_gmt' => string '2019-03-25 15:50:43' (length=19)
          public 'post_content_filtered' => string '' (length=0)
          public 'post_parent' => int 0
          public 'guid' => string 'http://exempel.se/?post_type=kulturprogram&#038;p=3621' (length=54)
          public 'menu_order' => int 0
          public 'post_type' => string 'kulturprogram' (length=13)
          public 'post_mime_type' => string '' (length=0)
          public 'comment_count' => string '0' (length=1)
          public 'filter' => string 'raw' (length=3)
          public 'url' => string 'http://exempel.se/kulturprogram/the-playground-2-6-ar/' (length=52)
          public 'labels' => 
            array (size=1)
              0 => 
                array (size=1)
                  'label' => string 'Dans' (length=4)
          public 'malgrupp' => string '' (length=0)
  1 => 
    array (size=1)
      'page' => 
        object(WP_Post)[6654]
          public 'ID' => int 4038
          public 'post_author' => string '11' (length=2)
          public 'post_date' => string '2019-03-25 07:53:02' (length=19)
          public 'post_date_gmt' => string '2019-03-25 07:53:02' (length=19)
          public 'post_content' => string 'En färgstark musikalisk dansföreställning!' (length=42)
          public 'post_title' => string 'Vilja Växa' (length=11)
          public 'post_excerpt' => string '' (length=0)
          public 'post_status' => string 'publish' (length=7)
          public 'comment_status' => string 'closed' (length=6)
          public 'ping_status' => string 'closed' (length=6)
          public 'post_password' => string '' (length=0)
          public 'post_name' => string 'vilja-vaxa' (length=10)
          public 'to_ping' => string '' (length=0)
          public 'pinged' => string '' (length=0)
          public 'post_modified' => string '2019-03-25 15:51:12' (length=19)
          public 'post_modified_gmt' => string '2019-03-25 15:51:12' (length=19)
          public 'post_content_filtered' => string '' (length=0)
          public 'post_parent' => int 0
          public 'guid' => string 'http://exempel.se/?post_type=kulturprogram&#038;p=4038' (length=54)
          public 'menu_order' => int 0
          public 'post_type' => string 'kulturprogram' (length=13)
          public 'post_mime_type' => string '' (length=0)
          public 'comment_count' => string '0' (length=1)
          public 'filter' => string 'raw' (length=3)
          public 'url' => string 'http://exempel.se/kulturprogram/vilja-vaxa/' (length=41)
          public 'labels' => 
            array (size=1)
              0 => 
                array (size=1)
                  'label' => string 'Dans' (length=4)
          public 'malgrupp' => string '3–6 år/familj' (length=16)

通过"Blade"在一个存档页面上显示数据

@php($myArcive = get_region_halland_acf_page_kulturprogram_archive_page())
  @if($myArcive['arkiv_image_large_url'] == 1)
    <img src="{{ $myArcive['arkiv_image_large_url'] }}" width="{{ $myArcive['arkiv_image_large_width'] }}" height="{{ $myArcive['arkiv_image_large_height'] }}"><br>
  @endif
  <h1>{{ $myArcive['arkiv_titel'] }}</h1><br><br>
  <span>{{ $myArcive['arkiv_ingress'] }}</span><br><br>
  <span>{{ $myArcive['arkiv_content'] }}</span><br><br>

存档页面的数组示例

array (size=9)
  'arkiv_has_image' => int 1
  'arkiv_image_large_url' => string 'http://dev-regionhalland-nytt-tema.local/app/uploads/2020/11/minbild.jpg' (length=72)
  'arkiv_image_large_width' => int 562
  'arkiv_image_large_height' => int 602
  'arkiv_image_large_alt' => string 'Min alttext' (length=11)
  'arkiv_image_large_caption' => string 'Min captiontext' (length=15)
  'arkiv_titel' => string 'Nya spaningar' (length=13)
  'arkiv_ingress' => string 'Nya spaningar Ingress' (length=21)
  'arkiv_content' => string '<p>Nya spaningar Brödtext</p>' (length=31)

版本历史

2.18.0

  • 从nycirkus更改为cirkus

2.8.1

  • 删除了不必要的字符

2.8.0

  • 添加了包含图片、标题、简介和内容的存档页面

2.7.0

  • 在文化节目类型上添加了分类的显示

2.6.0

  • 调整以确保文化节目类型使用Gutenberg作为编辑器

2.5.0

  • 通过Packagist添加了发布
  • 调整了composer名称

2.4.0

  • 添加了“Nycirkus”作为新的节目类型

2.3.0

  • 附带了许可证模型文件

2.2.0

  • 更新了许可证信息
  • 更新了repo链接

2.1.1

  • 对所有节目类型按字母顺序排序

2.1.0

  • 添加了“文学”作为新的节目类型
  • 更新了视图文件
  • 按字母顺序对各自的节目数组进行排序

2.0.0

  • 将名称从文化目录更改为文化节目
  • 播放时间字段现在称为长度

1.3.0

  • 为每个标签提供多数组特殊列表

1.2.0

  • 选择一个或多个类型,例如舞蹈、电影
  • 从文化目录中列出帖子的功能

1.1.0

  • 添加了has_archive = true以具有存档页面

1.0.0

  • 第一个版本