市镇/内容洞察力编辑器

内容洞察力编辑器是一个WordPress插件。

2.1.0 2023-03-10 13:05 UTC

README

内容编辑员跟踪其工作的一种简单方法,并在它们不正常工作时会收到通知

内容洞察力编辑器是一个WordPress插件

目录

使用方法

先决条件

内容洞察力编辑器使用matomo进行访客统计,并使用helsingborg-stad/broken-link-detector分析内容。

安装

此软件包可以手动下载并解压缩到/wp-content/plugins/目录中,或者使用composer。

运行以下命令进行安装

composer require municipio/content-insights-for-editors

composer的工作示例 在这里

安装资源完成后,可以通过在插件页面上查找“内容洞察力编辑器”条目并单击“激活”来激活插件。

钩子

以下是为自定义插件设置的钩子

设置邮件徽标URL

cife_notification_mail_logo_url

示例用法

add_action('cife_notification_mail_logo_url', function ($currentLogo) {
  $logo = get_field('logotype', 'option');
  return wp_get_attachment_url($logo['id']);
});

向邮件通知添加部分

cife_notification_mail_list_sections

示例用法

add_action('cife_notification_mail_list_sections', function($sections){
    array_push($sections, [
        'section_header' => '', // string, Title rendered above section
        'list' => [
            [
                'url' => '', // string, list item url
                'title' => '', // string, list item title
                'value' => 0, // mixed, Value to display in the second column (OPTIONAL)
            ],
            ...
        ],
        'list_header' => ['title' => '', 'value' => ''], // array, Explaining list.title and list.value
        'no_items_text' => '', // string, Replace list if empty
    ]);
    return $sections;
});

修改渲染期间使用的部分模板

cife_notification_mail_render_section

示例用法

add_action('cife_notification_mail_list_sections', function (
  $template,
  $sectionVars
) {
  if (
    $_sectionVars['id'] === 'most-viewed' &&
    class_exists('\CustomerFeedback\App')
  ) {
    return CONTENT_INSIGHTS_FOR_EDITORS_MAIL_TEMPLATE_PATH .
      '/partials/section-3-cols-customer-feedback.template.php';
  }
  return $template; // Absolute php file path
});

自定义邮件通知的内容

cife_notification_mail_vars

公开变量

'logo'  // string, Logourl showed in top of email
'intro_header' // string, Title showen in top of email
'intro_text' // string, Text showen in top of email
'button_cta_text' // string, NULL to hide
'button_cta_url' // string, NULL to hide

示例用法

add_action('cife_notification_mail_vars', function ($html_vars) {
  $html_vars['logo'] = "...";
  return $html_vars;
});

开发

以下说明将帮助您在本地机器上创建项目副本并进行开发测试。有关在生产中如何使用插件的信息,请参阅使用方法

本地先决条件

内容洞察力编辑器使用matomo进行访客统计,并使用helsingborg-stad/broken-link-detector分析内容。

本地安装

可以使用composer安装此插件或将此存储库从github克隆到WordPress安装的/wp-content/plugins/目录中。

使用composer

将此添加到您的composer.json中

"repositories": [
    {
        "type": "path",
        "url": "/my/local/path/content-insights-for-editors"
    },
    ...
]

"require": {
    ...
    "content-insights-for-editors": "dev-master"
},

并将此添加到安装helsingborg-stad/broken-link-detector

"repositories": [
    {
        "type": "vcs",
        "url": "git@github.com:helsingborg-stad/broken-link-detector.git",
        "no-api": true
    },
    ...
]

"require": {
    ...
    "helsingborg-stad/broken-link-detector": "^1.3",
},

然后运行

composer install

composer的工作示例 在这里

贡献

  1. 将其分支(https://github.com/yourname/yourproject/fork
  2. 创建您的功能分支(git checkout -b feature/fooBar
  3. 提交您的更改(git commit -am 'Add some fooBar'
  4. 将分支推送到远程仓库(git push origin feature/fooBar
  5. 创建一个新的拉取请求

版本控制

我们使用SemVer进行版本控制。有关可用版本,请参阅此存储库的标签

作者

查看参与此项目的贡献者列表。

许可证

本项目采用MIT许可证 - 有关详细信息,请参阅LICENSE.md文件。