[wordpress插件] Complete Open Graph完整的开放图

wordpress 插件 文章 2020-03-29 22:40 429 0 全屏看文

AI助手支持GPT4.0

评分
100
描述

There’s no shortage of plugins that promise to be THE all-in-one solution for all things SEO.

不乏承诺成为SEO一切事物的一站式解决方案的插件。

Unfortunately, this often means lack of flexibility, confusing implementation, or just a big, bloated plugin that carries way too many features for your needs.

不幸的是,这通常意味着缺乏灵活性,混乱的实现,或者仅仅是一个庞大的,肿的插件,无法满足您的需求。

This plugin is built on an alternative philosophy: do one thing and one thing well.

此插件建立在另一种哲学之上:做好一件事情和一件事情。

Complete Open Graph provides automatic, comprehensive, just-makes-sense Open Graph management, whether it’s for a simple blog or a complex site with diverse sets of content.

完整的开放图谱提供了自动,全面,公正的开放图谱管理,无论是用于简单的博客还是具有多种内容的复杂站点。

Out of the box, Complete Open Graph generates all the basic tags your site should have, making it ready for social sharing on platforms including Twitter, Facebook, LinkedIn and Google+, and gives you full programmatic access to filter this data as you

开箱即用的“完整开放图谱”会生成您的网站应具有的所有基本标签,使其可以在Twitter,Facebook,LinkedIn和Google+等平台上进行社交共享,并为您提供完全的编程访问权限,以便您在过滤数据时

need.

需要。

TL;DR: This plugin does Open Graph.

TL; DR:此插件可以执行Open Graph。

Freaking good Open Graph.

令人难以置信的好的开放图。

Using the Plugin

使用插件

Upon activation, Complete Open Graph is ready to generate Open Graph meta tags, with an intuitive set of fallbacks in place.

激活后,完全开放图就可以生成开放图元标记,并具有一组直观的后备选项。

Literally no configuration is required to begin making your site socially shareable.

从字面上看,无需进行任何配置即可开始使您的网站在社会上可共享。

Available Fields

可用字段

On each page and post, the following fields are automatically generated, based on available page data.

在每个页面和帖子上,将根据可用的页面数据自动生成以下字段。

Many of these can be manually set at the page/post level.

其中许多可以在页面/帖子级别手动设置。

    • og:site_name
    • og:site_name

    • og:locale
    • og:locale

    • og:type
    • og:type

    • og:title
    • og:title

    • og:url
    • og:url

    • og:description
    • og:description

    • og:image
    • og:image

    • og:image:width
    • og:image:width

    • og:image:height
    • og:image:height

    • twitter:card
    • twitter:card

    • twitter:creator
    • twitter:creator

    • twitter:title
    • twitter:title

    • twitter:description
    • twitter:说明

    • twitter:image
    • twitter:image

    • twitter:url
    • twitter:url

    • twitter:site
    • twitter:site

    • profile:first_name (Currently only displayed on individual author pages.)
    • profile:first_name(当前仅显示在单个作者页面上。)

    • profile:last_name (Currently only displayed on individual author pages.)
    • profile:last_name(当前仅显示在单个作者页面上。)

    Default Settings

    默认设置

    As a fallback for values that aren’t filled automatically by a page or post, you can set default values for Open Graph data.

    作为页面或帖子未自动填充的值的备用,您可以为“打开图表”数据设置默认值。

    If desired, you can force these individual values to be used globally, overriding whatever is set at a page/post level.

    如果需要,您可以强制全局使用这些单独的值,从而覆盖在页面/帖子级别设置的任何值。

    You’re able to force individual fields, or force all of them at once.

    您可以强制单个字段,也可以一次强制所有字段。

      • og:type
      • og:type

      • og:title
      • og:title

      • og:image
      • og:image

      • og:image:width
      • og:image:width

      • og:image:height
      • og:image:height

      • og:description
      • og:description

      • twitter:card
      • twitter:card

      • twitter:description
      • twitter:说明

      • twitter:creator
      • twitter:creator

      • twitter:site
      • twitter:site

      • fb:admins
      • fb:admins

      • fb:app_id
      • fb:app_id

      Filters

      过滤器

      The complete_open_graph_all_data filter allows the customization of the entire set of Open Graph values, as well as the addition of new meta tags (including those that aren’t Open Graph).

      complete_open_graph_all_data 过滤器允许自定义整个Open Graph值集,以及添加新的元标记(包括那些不是Open Graph的元标记)。

      Example for customizing out-of-the-box Open Graph data:

      自定义开箱即用的开放图数据的示例:

      function modify_open_graph_data($data) {  

        function Modify_open_graph_data($ data){  

      $data['og:site_name']['value'] = 'whatevs';  

      $ data ['og:site_name'] ['value'] ='whatevs';  

      return $data;

      返回$ data;

      }

      }

      add_filter('complete_open_graph_all_data', 'modify_open_graph_data');

      add_filter('complete_open_graph_all_data','modify_open_graph_data');

      Example for adding a standard, old meta tag:

      添加标准的旧元标记的示例:

      function add_new_open_graph_fields($data) {    

        function add_new_open_graph_fields($ data){    

      $data['keywords']['attribute'] = 'name';    

      $ data ['keywords'] ['attribute'] ='名称';    

      $data['keywords']['value'] = 'keyword1,keyword2,keyword3';    

      $ data ['keywords'] ['value'] ='keyword1,keyword2,keyword3';    

      return $data;

      返回$ data;

      }

      }

      add_filter('complete_open_graph_all_data', 'add_new_open_graph_fields');

      add_filter('complete_open_graph_all_data','add_new_open_graph_fields');

      The complete_open_graph_processed_value filter allows you to modify a single field after it’s gone through the progression of priorities.

      通过 complete_open_graph_processed_value 过滤器,您可以在优先级提高后修改单个字段。

      For that reason, it will only be effective on the following fields:

      因此,它仅对以下字段有效:

        • og:description
        • og:description

        • og:title
        • og:title

        • og:type
        • og:type

        • og:image
        • og:image

        • twitter:card
        • twitter:card

        • twitter:title
        • twitter:title

        • twitter:image
        • twitter:image

        • twitter:description
        • twitter:说明

        • twitter:creator
        • twitter:creator

        Example for manipulating a processed value:

        处理处理后的值的示例:

        function manipulate_processed_value($value, $field_name) {    

          function handler_processed_value($ value,$ field_name){    

        if($field_name === 'og:description') {        

        if($ field_name ==='og:description'){        

        return 'WHATEVER I WANT.';    

        返回“我想要的一切”。    

        }    

        }    

        return $value;

        返回$ value;

        }

        }

        add_filter('complete_open_graph_processed_value', 'manipulate_processed_value', 10, 2);

        add_filter('complete_open_graph_processed_value','manipulate_processed_value',10,2);

        The complete_open_graph_{$tagName} filter allows you to modify a single field by identifying it by name and returning a modified value.

        complete_open_graph _ {$ tagName} 过滤器允许您通过按名称标识单个字段并返回修改后的值来修改单个字段。

        These names are the “name” or “property” attributes on the meta tags.

        这些名称是元标记上的“名称”或“属性”属性。

        See “Available Fields” above for these names.

        这些名称请参见上面的“可用字段”。

        Example for manipulating a single value by name:

        通过名称操作单个值的示例:

        function modify_title($value, $field_name) {    

          function Modify_title($ value,$ field_name){    

        return 'My Newly Modified Title!'

        返回“我的新修改标题!”

        }

        }

        add_filter('complete_open_graph_og:title', 'modify_title', 10, 2);

        add_filter('complete_open_graph_og:title','modify_title',10,2);

        The complete_open_graph_maybe_enable filter allows you to disable tag generation altogether by returning a boolean.

        complete_open_graph_maybe_enable 过滤器允许您通过返回布尔值来完全禁用标记生成。

        Example for disabling generation altogether:

        完全禁用生成的示例:

        add_filter('complete_open_graph_maybe_enable', '__return_false');

          add_filter('complete_open_graph_maybe_enable','__return_false');

        Example for disabling generation on a specific page:

        在特定页面上禁用生成的示例:

        add_filter('complete_open_graph_maybe_enable', function ($maybeEnable) {    

          add_filter('complete_open_graph_maybe_enable',函数($ maybeEnable){    

        global $post;    

        全球$ post;    

        if($post->post_name === 'my-page') {        

        if($ post-> post_name ==='我的页面'){        

        return false;    

        返回false;    

        }    

        }    

        return $maybeEnable;

        返回$ maybeEnable;

        });

        });

        Order of Priority

        优先顺序

        There’s a fallback system set in place for you to effectively leverage this plugin.

        已设置一个备用系统,可让您有效利用此插件。

        Below is the order of priority:

        以下是优先顺序:

          1. Filters – Any filters you apply in your code will take priority over any fields you have filled in the admin.
          2. 过滤器 –您在代码中应用的所有过滤器都将优先于您在管理员中填写的所有字段。

          3. Forced Global Settings – If you’ve checked the box on these fields on the settings page, they’ll override everything non-filtered.
          4. 强制全局设置 –如果已选中“设置”页面上这些字段的框,则它们会覆盖所有未过滤的内容。

          5. Post/Page COG Fields – Filling out the meta box fields on a page or post in the WordPress Admin will give it priority over any default settings (unless they're forced).

          6. 帖子/页面COG字段 –在WordPress Admin中填写页面或帖子上的meta框字段将使其具有高于任何默认设置的优先级(除非强制使用)。

            >

            >

          7. Post/Page Content – If no specific COG fields on the post/page are set, the post/page content itself will be used.

          8. 帖子/页面内容 –如果在帖子/页面上未设置特定的COG字段,则将使用帖子/页面内容本身。

            For the Open Graph description, the excerpt will be respected if it’s filled.

          9. 对于“打开图表”说明,摘录如果被填写,将受到尊重。

          10. Default COG Settings – Next, the default COG global settings will used to populate Open Graph tags.
          11. 默认COG设置 –接下来,默认COG全局设置将用于填充Open Graph标签。

          12. Blog Info – When nothing else is overriding them, Open Graph fields will default to your general WordPress site settings.
          13. 博客信息 –如果没有其他东西可以覆盖它们,则“打开图表”字段将默认为您的一般WordPress网站设置。

          After flowing through this order of priority, if there is still no content to be pulled, those respective Open Graph tags will not be generated.

          按照优先级顺序排列后,如果仍然没有要提取的内容,则不会生成这些相应的“打开图”标记。

          So, don’t worry about having extra, useless tags just sitting there in your markup.

          因此,不必担心只是多余的无用标签就位于标记中。

          Feedback

          反馈

          You like it?

          您喜欢吗?

          Email or tweet<

          电子邮件 tweet <

          /a> me.

          / a>我。

          You hate it?

          你讨厌吗

          Email or tweet<

          电子邮件 tweet <

          /a> me.

          / a>我。

          Regardless of how you feel, your review would be greatly appreciated!

          无论您的感觉如何,您的评论都将不胜感激!

安装步骤

    1. Download the plugin and upload to your plugins directory, or install the plugin through the WordPress plugins page.
    2. 下载插件并上传到您的插件目录,或通过WordPress插件页面安装插件。

    3. Activate the plugin on the ‘Plugins’ page.
    4. 在“插件”页面上激活插件。

    5. (Optional) Use the Settings->Open Graph screen to set your default Open Graph data.
    6. (可选)使用“设置”->“打开图”屏幕来设置默认的“打开图”数据。

下载地址
https://downloads.wordpress.org/plugin/complete-open-graph.3.4.5.zip
-EOF-

AI助手支持GPT4.0