[wordpress插件] Brickset APIBrickset API

wordpress 插件 文章 2020-03-11 13:40 641 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

This plugin is an implementation of the Brickset Webservice.

此插件是Brickset Web服务的实现。

It includes methods to get LEGO® set and theme data from Brickset as well as pre-formated methods to display set data.

它包括从Brickset获取LEGO®布景和主题数据的方法,以及用于显示布景数据的预格式化方法。

The set data requested is cached daily to reduce HTTP requests and page load time.

每天都会缓存请求的设置数据,以减少HTTP请求和页面加载时间。

Please visit Brickset for more information on the

有关 Brickset

="nofollow">webservice.

=“ nofollow”>网络服务。

You can obtain an API key from Brickset.

您可以从 Brickset 获取API密钥。

The main development is all happening on GitHub.

主要开发都在 GitHub 上进行。

This is not an official Brickset.com plugin.

这不是官方的Brickset.com插件。

LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this plugin.

LEGO®是LEGO Group of Companies的商标,不赞助,授权或认可此插件。

Oembed

嵌入

You can paste a Brickset set or theme url into your post or page.

您可以将Brickset集或主题URL粘贴到您的帖子或页面中。

Once you publish the post or page information about the set or theme will be displayed.

发布后,将显示有关布景或主题的信息。

Two example URLs are below.

以下是两个示例URL。

    • Set URL: http://brickset.com/detail/?Set=79003-1
    • 设置URL:http://brickset.com/detail/?Set=79003-1

    • Theme URL: http://brickset.com/browse/themes/?theme=The%20Hobbit
    • 主题URL:http://brickset.com/browse/themes/?theme=The%20Hobbit

    Template Tags

    模板标签

    The plugin has numerous template tags you are able to use in your theme.

    该插件具有许多可以在主题中使用的模板标签。

    They are listed below with a short description.

    下面列出了它们,并提供了简短说明。

      • brickset_themes(); outputs a list of all themes.
      • brickset_themes(); 输出所有主题的列表。

      • brickset_subthemes( $theme ); outputs a table of all subthemes of the theme specified, the number of sets, and years available.
      • brickset_subthemes($ theme); 输出一个表,其中包含指定主题的所有子主题,集合数和可用年份。

      • brickset_theme_years( $theme ); outputs a table of all the years the specified theme was available and the number of sets each year.
      • brickset_theme_years($ theme); 输出一个表格,列出指定主题可用的所有年份以及每年的套数。

      • brickset_popular_searches(); outputs a list of the most popular search terms on Brickset.com.
      • brickset_popular_searches(); 输出Brickset.com上最受欢迎的搜索词的列表。

      • brickset_updated_since( $date ); outputs a table of the sets updated since the date specified.

      • brickset_updated_since($ date); 输出自指定日期以来更新的集合的表。

        The table includes thumbnail, set name and set number.

      • 该表包括缩略图,设置名称和设置编号。

      • brickset_set_number( $set ); outputs a list of details about the sets specified.

      • brickset_set_number($ set); 输出有关指定集合的​​详细信息列表。

        More than one set can be requested by separating the set numbers with a comma, e.g.

        可以通过用逗号分隔设置编号来请求多个设置,例如用逗号分隔。

        ‘1380,10240’.

      • ‘1380,10240’。

      Shortcode

      简码

      The plugin has a shortcode you may use in your posts and pages to display information about a set or sets.

      该插件具有一个短代码,您可以在帖子和页面中使用该短代码来显示有关一个或多个集合的信息。

        • [bs_set number='XXX'] outputs information about a specific set.

        • [bs_set number ='XXX'] 输出有关特定集合的信息。

          Thumbnail, set name, set number, pieces, theme, subtheme and year.

          缩略图,设置名称,设置编号,片段,主题,子主题和年份。

          You can display multiple sets by seperating the set numbers with a comma.

        • 您可以通过用逗号分隔集号来显示多个集。

        Widgets

        小部件

        The plugin has four widgets you can activate in your theme.

        该插件有四个可以在主题中激活的小部件。

        The first displays a list of all themes on Brickset with a link to browse each theme on Brickset.com and the second to display the details about a specific set.

        第一个显示Brickset上所有主题的列表,并带有一个链接,以浏览Brickset.com上的每个主题,第二个显示有关特定集合的详细信息。

        The third allows you to show off the total count of your minifigs.

        第三个允许您炫耀小人仔的总数。

        The last widget displays a count of sets produced in each year for a given theme.

        最后一个小部件显示每年为给定主题制作的套数。

        Advanced Use

        高级使用

        This example shows how to get the data about a specific set.

        此示例显示如何获取有关特定集的数据。

        You can find the developer docs here.

        您可以在此处找到开发人员文档。

          1. Instantiate the class.

            实例化课程。

            $brickset = new BricksetAPISearch();

            $ brickset = new BricksetAPISearch();

          2. Pass a set number to the get_by_number method.

            将一组数字传递给get_by_number方法。

            $set_data = $brickset->get_by_number( ‘8014’ );

            $ set_data = $ brickset-> get_by_number('8014');

          3. Test for an error

            测试错误

            if( is_wp_error( $set_data ) {
                

            if(is_wp_error($ set_data){
                

            echo $set_data->get_error_message;

            echo $ set_data-> get_error_message;

            }

            }

          4. Display the results how you like.

            根据需要显示结果。

            This will display the set’s theme.

            这将显示场景的主题。

            else {
                

            else {
                

            echo $set_data->theme;

            echo $ set_data-> theme;

            }

            }

          Road Map

          路线图

            1. Template tags to display sets specific to a user.
            2. 用于显示特定于用户的集的模板标签。

            3. Caching of images
            4. 图像缓存

            You can follow all the open feature requests and enhancements on GitHub

            您可以在 GitHub上关注所有打开的功能请求和增强功能。

            .

安装步骤

    1. Upload the entire brickset-api folder to the wp-content/plugins/ directory of your WordPress installation or download from the Plugin Repository
    2. 将整个 brickset-api 文件夹上载到WordPress安装目录的 wp-content / plugins / 目录中,或从插件存储库中下载

    3. Activate the plugin through the Plugins menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

    5. Add your Brickset.com API key to the Brickset settings page which can be found as a submenu under the Settings menu
    6. 将您的Brickset.com API密钥添加到Brickset设置页面,该页面可在“设置”菜单下作为子菜单找到。

    7. Either add a Brickset link (url) to a set or theme in a post or page, or add a template tag to a theme file, or for advanced use instantiate the class and create your own display method.
    8. 或者将Brickset链接(url)添加到帖子或页面中的集合或主题,或者将模板标签添加到主题文件,或者供高级使用实例化该类并创建您自己的显示方法。

下载地址
https://downloads.wordpress.org/plugin/brickset-api.1.4.1.zip
-EOF-

AI助手支持GPT4.0