[wordpress插件] Domain Name Autoswitch域名自动切换

wordpress 插件 文章 2020-04-21 01:21 0 37 全屏看文
评分
0
描述

Here is a useful method you should use any where you need it dnas_get_post_ID().

这是一种有用的方法,您应该在需要的任何地方使用它 dnas_get_post_ID()

It returns the post ID (if any) related to the current domain name.

它返回与当前域名相关的帖子ID(如果有)。

For instance, if you would like to display URL of the fake home page:    

例如,如果您想显示假主页的URL:    

You can check the plugin development on github.

您可以在 github 上检查插件的开发。

Pros:

优点:

    • since the plugin does not modify nor use your .htaccess file,

    • 因为该插件不会修改或使用您的 .htaccess 文件,

      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()

      • 因为它入侵了查询变量,所以一些模板标记(例如 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

      插件在类别#4
      的任何帖子上显示其domain字段

      and #8, then:

      和#8,然后:

      $dnas_categories_ID = array( 4, 8 );

        $ 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,

      公开许可,版本2 ,

      as published by Sam Hocevar.

      由Sam Hocevar发布。

      See (http://www.wtfpl.net/) for more details.

      有关更多详细信息,请参见(http://www.wtfpl.net/)。

安装步骤

    1. First, unzip or upload the plugin into /wp-content/plugins/.
    2. 首先,将插件解压缩或上传到 / wp-content / plugins /

    3. In the plugin directory, edit the following file:
          

    4. 在插件目录中,编辑以下文件:
          

      sample-domain-name-autoswitch-config.php.

    5. 样本域名自动切换配置.php。

    6. Then, rename the config file to: domain-name-autoswitch-config.php.
    7. 然后,将配置文件重命名为: domain-name-autoswitch-config.php

    8. Activate the plugin through the WordPress Plugins admin page.
    9. 通过WordPress插件管理页面激活插件。

    10. Set up your domain names like you want to, directly through the

    11. 直接通过
      设置所需的域名

      posts’ edit pages.

    12. 帖子的编辑页面。

    13. Obviously, you will have to set up your virtual hosts (ServerAlias

    14. 很显然,您必须设置虚拟主机( ServerAlias

      directives), so every domain names you want to use are pointing to

      指令),因此您要使用的每个域名都指向

      your WordPress instance.

    15. 您的WordPress实例。

下载地址
https://downloads.wordpress.org/plugin/domain-name-autoswitch.zip
-EOF-