[WordPress] 外掛分享: Domain Name Autoswitch

首頁外掛目錄 › Domain Name Autoswitch
10+
安裝啟用
尚無評分
4294 天前
最後更新
問題解決
v1.2.4 上架:2014-02-24

內容簡介

這裡有一個你應該在需要時使用的有用方法 dnas_get_post_ID()。

它返回與當前域名相關聯的文章ID(如果有)。
例如,如果您想顯示虛擬主頁的URL:

您可以在 github 上檢查插件開發。

優點:

由於該插件不修改也不使用您的 .htaccess 文件,
它與每種固定鏈接格式都可以正常工作。
允許您通過您的帖子編輯表單直接管理您的域名。

缺點:

由於它會干擾查詢變量,一些模板標籤(如 is_home())
在觸發專用域名時可能無法按預期工作。
請注意,沒有衝突支持:您可以為多個帖子填充相同的域名。
只會有一個域名獲勝,而您沒有控制權(但如果您注意到它,很容易看到哪個需要檢查...)。 請小心!

配置

插件適用於自定義帖子類型和經典帖子類型。
您必須編輯配置文件,以指示插件應在哪些帖子中添加其域名字段。您可以指定類別標識符或/和帖子類型別名。例如,要使插件在類別#4和#8的任何帖子上顯示其域名字段,請使用以下內容:

$dnas_categories_ID = array( 4, 8 );

依存關係

需要Advanced Custom Fields 插件。

許可證

本程序是自由軟件,根據適用法律的限制範圍,不附帶任何保證。 您可以
在 Sam Hocevar 發布的 Do What The Fuck You Want To Public License, Version 2 下重新分發和/或修改它。
詳細信息請訪問 (http://www.wtfpl.net/)。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.2.4) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Domain Name Autoswitch」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Here is a useful method you should use any where you need it dnas_get_post_ID().
It returns the post ID (if any) related to the current domain name.
For instance, if you would like to display URL of the fake home page:

You can check the plugin development on github.
Pros:

since the plugin does not modify nor use your .htaccess file,
it works with every permalink formats.
allow you to manage your domain names directly through your
post edit forms.

Cons:

since it hacks the query variables, some template tags like is_home()
could not work as expected if a dedicated domain name is triggered.
be aware there is no conflict support: you can fill the same domain
for several posts. Only a single one will win the game, without
any control from your part (but it will be easy to see which one have
to be checked… if you ever notice it). Be careful!

Configuration
The plugin works with both custom post types and classic post type.
You have to edit a configuration file in order to indicate on which
posts the plugin should add its domain name field. You can indicate
Categorie identifiers or/and Post Types slugs. For instance, to make
the plugin showing its domain field on any posts of the categories #4
and #8, then:
$dnas_categories_ID = array( 4, 8 );

Dependency
The Advanced Custom Fields
plugin is required.
License
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2,
as published by Sam Hocevar. See (http://www.wtfpl.net/) for more details.

延伸相關外掛

文章
Filter
Mastodon