regionhalland/region-halland-plugin-acf-site-settings-image-link-repeater

创建一个包含链接的图片列表,用于在页脚等地方使用

v1.2.0 2020-11-04 15:58 UTC

This package is auto-updated.

Last update: 2024-09-05 00:12:40 UTC


README

如何使用Region Halland的插件"RhAcfSiteSettingsImageLinkRepeater"

以下是使用"RhAcfSiteSettingsImageLinkRepeater"插件的操作指南。

使用范围

此插件在管理后台创建带有图片和链接的重复字段

许可证模型

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

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

通过composer导入插件

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

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

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

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

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

"require": {
  "regionhalland/region-halland-plugin-acf-site-settings-image-link-repeater": "1.0.0"
},

通过"Blade"循环输出图片和链接

@if(function_exists('get_region_halland_acf_site_settings_image_link_repeater_list'))
  @php($myImages = get_region_halland_acf_site_settings_image_link_repeater_list())
  @if($myImages['number_of_images'] > 0)
    @foreach ($myImages['images'] as $image)
      @if ($image['has-image-link'] == 1)
        <a href="{{ $image['image-link-url'] }}" target="{{ $image['image-link-target'] }}"><img src="{{ $image['image-url'] }}" width="{{ $image['image-width'] }}" height="{{ $image['image-height'] }}"></a>
      @else
        <img src="{{ $image['image-url'] }}" width="{{ $image['image-width'] }}" height="{{ $image['image-height'] }}">
      @endif
    @endforeach
  @endif
@endif

数组可能的外观示例

array (size=2)
  'number_of_images' => int 6
  'images' => 
    array (size=6)
      0 => 
        array (size=7)
          'image-url' => string 'http://dev-template.local/app/uploads/2020/04/sol-a-73x70.jpg' (length=61)
          'image-width' => int 73
          'image-height' => int 70
          'image-alt' => string '' (length=0)
          'image-caption' => string '' (length=0)
          'has-image-link' => int 1
          'image-link-title' => string 'Puff C' (length=6)
          'image-link-url' => string 'http://dev-template.local/puffar/puff-c/' (length=40)
          'image-link-target' => string '' (length=0)
      1 => 
        array (size=7)
          'image-url' => string 'http://dev-template.local/app/uploads/2020/04/sol-b-64x70.jpg' (length=61)
          'image-width' => int 64
          'image-height' => int 70
          'image-alt' => string '' (length=0)
          'image-caption' => string '' (length=0)
          'has-image-link' => int 1
          'image-link-title' => string 'Puff B' (length=6)
          'image-link-url' => string 'http://dev-template.local/puffar/puff-b/' (length=40)
          'image-link-target' => string '' (length=0)
      2 => 
        array (size=7)
          'image-url' => string 'http://dev-template.local/app/uploads/2020/04/sol-c-75x70.jpg' (length=61)
          'image-width' => int 75
          'image-height' => int 70
          'image-alt' => string '' (length=0)
          'image-caption' => string '' (length=0)
          'has-image-link' => int 1
          'image-link-title' => string 'Puff A' (length=6)
          'image-link-url' => string 'http://dev-template.local/puffar/puff-a/' (length=40)
          'image-link-target' => string '_blank' (length=6)
      3 => 
        array (size=7)
          'image-url' => string 'http://dev-template.local/app/uploads/2020/04/sol-d-70x70.jpg' (length=61)
          'image-width' => int 70
          'image-height' => int 70
          'image-alt' => string '' (length=0)
          'image-caption' => string '' (length=0)
          'has-image-link' => int 1
          'image-link-title' => string 'Extrainfo 1' (length=11)
          'image-link-url' => string 'http://dev-template.local/extrainfo/extrainfo-1/' (length=48)
          'image-link-target' => string '' (length=0)
      4 => 
        array (size=7)
          'image-url' => string 'http://dev-template.local/app/uploads/2020/04/sol-e-70x70.png' (length=61)
          'image-width' => int 70
          'image-height' => int 70
          'image-alt' => string '' (length=0)
          'image-caption' => string '' (length=0)
          'has-image-link' => int 1
          'image-link-title' => string 'Extrainfo 2' (length=11)
          'image-link-url' => string 'http://dev-template.local/extrainfo/extrainfo-2/' (length=48)
          'image-link-target' => string '' (length=0)
      5 => 
        array (size=7)
          'image-url' => string 'http://dev-template.local/app/uploads/2020/04/sol-f-64x70.jpg' (length=61)
          'image-width' => int 64
          'image-height' => int 70
          'image-alt' => string '' (length=0)
          'image-caption' => string '' (length=0)
          'has-image-link' => int 1
          'image-link-title' => string 'Extrainfo 3' (length=11)
          'image-link-url' => string 'http://dev-template.local/extrainfo/extrainfo-3/' (length=48)
          'image-link-target' => string '_blank' (length=6)

版本历史

1.3.0

  • ACF字段现在在WP-JSON REST API中显示

1.2.0

  • 为图片添加alt和标题文本

1.1.1

  • 跳过未选择的附加字段

1.1.0

  • 添加一个检查以确定是否有任何图片链接

1.0.0

  • 第一个版本