# User Guide - Affiliate Quick Link Shortcode for DMM

This plugin provides an easy way to embed affiliate links and media from DMM via shortcode.

---

## 🔧 Basic Usage

Use the `[quick_link_dmm]` shortcode to embed a product link using either a CID (content ID) or AID (auction ID).

### Example (with CID)

[quick_link_dmm cid="1dandy00463"]

This will output a linked image with large thumbnail size and the affiliate ID `lab888-001` (default).

---

### Example (with AID)

[quick_link_dmm aid="2011464"]

This will generate a text link to the auction page.

---

## 📐 Optional Parameters

| Parameter   | Description                                                               |
| ----------- | ------------------------------------------------------------------------- |
| `cid`       | Content ID of the digital product                                         |
| `aid`       | Auction ID (used instead of `cid`)                                        |
| `size`      | Image size: `"large"` (default), `"small"`, `"simple"`, or `"video"`      |
| `aff`       | Custom affiliate ID (default: `lab888-001`)                               |
| `link_only` | `"1"` for plain URL output, `"wp"` for plain URL with `!` to avoid oEmbed |

> ⚠️ If both `cid` and `aid` are present, `cid` takes priority.

---

## 🎞️ `size="video"` Option

To embed a sample video trailer:

[quick_link_dmm cid="1dandy00914a" size="video"]

This will render an iframe-based embedded player from DMM.

---

## 🔗 `link_only` Option

### Plain URL:

[quick_link_dmm cid="1dandy00463" link_only="1"]

Outputs a plain affiliate URL.

### Plain URL (prevent oEmbed):

[quick_link_dmm cid="1dandy00463" link_only="wp"]

Outputs the URL with a `!` prefix to avoid WordPress auto-embed behavior:

!https://al.dmm.co.jp/?lurl=...&af_id=lab888-001...

---

## 🆕 v1.4.1 以降の新機能：フローティングバナー

バージョン 1.4.1 以降では、以下のようなフローティングバナー機能が利用できます。

### サンプル

```
[quick_link_dmm cid="1dandy00463" size="floating" show_at="10" delay="3"]
```

- `show_at` : ページ全体の何%スクロールで表示待機状態にするか（0 でスクロール無視）
- `delay` : スクロール停止後、何秒後に表示するか（`show_at=0`時はページロード後の秒数）
- `z-index` : PHP/JS で直接調整可能（デフォルト 2250、必要に応じて変更）

#### 例

- `[quick_link_dmm cid="1dandy00463" size="floating"]`（デフォルト: 20%スクロール+2 秒後表示）
- `[quick_link_dmm cid="1dandy00463" size="floating" show_at="0" delay="5"]`（ページロード 5 秒後に表示）
- `[quick_link_dmm cid="1dandy00463" size="floating" show_at="30" delay="1"]`（30%スクロール+1 秒後表示）

#### 注意点

- バナーは body 直下に移動し、z-index で重なり順を細かく制御できます。
- マウスオーバーで拡大＆不透明化、閉じるボタン、レスポンシブ対応。
- 詳細は README や changelog も参照してください。

---

## ⚙️ Settings

You must configure your **API ID** in the admin screen:
**Dashboard → Settings → Quick Link DMM**

Without this, the plugin cannot retrieve data and will return blank.

---

## 🧪 Troubleshooting

- **No image appears** → Check if your API ID is set correctly
- **Empty output** → Check if the CID or AID is valid
- **DMM API down** → Retry after some time

---

## 📝 License

This plugin is licensed under GPLv2 or later.
It uses [DMM Web Services](https://affiliate.dmm.com/) and follows their [terms of use](https://affiliate.dmm.com/terms/).

---

© TROK Inc.
