[wordpress插件] CSS Flags libraryCSS标志库

wordpress 插件 文章 2020-04-06 02:20 616 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

The CSS Flags plugin / library for WordPress loads a dynamicaly created CSS with responsive flags.

用于WordPress的CSS Flags插件/库会加载带有响应标志的动态创建的CSS。

Note: CSS Flags is not a standalone plugin/library, To display the flags you will have to add code to your theme using your own plugin or theme functions.php

example-1“ rel =” nofollow“>使用您自己的插件或主题函数将代码添加到主题。

You can view the flags at my site

您可以查看我网站上的标志

Sample CSS:

示例CSS:

.css-flag.sami {    

  .css-flag.sami {    

background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHZlcnNpb249IjEuMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjAyMCIgaGVpZ2h0PSIxNTAwIj48cmVjdCB3aWR0aD0iNjQ1IiBoZWlnaHQ9IjE1MDAiIGZpbGw9IiNkODFlMDUiLz48cmVjdCB4PSI2NDUiIHdpZHRoPSIxNDAiIGhlaWdodD0iMTUwMCIgZmlsbD0iIzAwN2EzZCIvPjxyZWN0IHg9Ijc4NSIgd2lkdGg9IjE0MCIgaGVpZ2h0PSIxNTAwIiBmaWxsPSIjZmNkMTE2Ii8+PHJlY3QgeD0iOTI1IiB3aWR0aD0iMTA5NSIgaGVpZ2h0PSIxNTAwIiBmaWxsPSIjMDAzOGE4Ii8+PHBhdGggZD0iTSA3ODUsMzEwIGEgNDQwIDQ0MCAwIDAgMCAwLDg4MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAzOGE4IiBzdHJva2Utd2lkdGg9IjgwIi8+PHBhdGggZD0iTSA3ODUsMzEwIGEgNDQwIDQ0MCAwIDAgMSAwLDg4MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZDgxZTA1IiBzdHJva2Utd2lkdGg9IjgwIi8+PC9zdmc+');    

背景图像:网址( '数据:图像/ SVG + xml的; BASE64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHZlcnNpb249IjEuMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjAyMCIgaGVpZ2h0PSIxNTAwIj48cmVjdCB3aWR0aD0iNjQ1IiBoZWlnaHQ9IjE1MDAiIGZpbGw9IiNkODFlMDUiLz48cmVjdCB4PSI2NDUiIHdpZHRoPSIxNDAiIGhlaWdodD0iMTUwMCIgZmlsbD0iIzAwN2EzZCIvPjxyZWN0IHg9Ijc4NSIgd2lkdGg9IjE0MCIgaGVpZ2h0PSIxNTAwIiBmaWxsPSIjZmNkMTE2Ii8 + PHJlY3QgeD0iOTI1IiB3aWR0aD0iMTA5NSIgaGVpZ2h0PSIxNTAwIiBmaWxsPSIjMDAzOGE4Ii8 + PHBhdGggZD0iTSA3ODUsMzEwIGEgNDQwIDQ0MCAwIDAgMCAwLDg4MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAzOGE4IiBzdHJva2Utd2lkdGg9IjgwIi8 + PHBhdGggZD0iTSA3ODUsMzEwIGEgNDQwIDQ0MCAwIDAgMSAwLDg4MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZDgxZTA1IiBzdHJva2Utd2lkdGg9IjgwIi8 + PC9zdmc +');    

height: 100%;    

高度:100%;    

width: 134.666666667%;    

宽度:134.666666667%;    

background-size: 100% 100%;

背景大小:100%100%;

}

}

.css-flag.sami-landscape {    

.css-flag.sami-landscape {    

height: 100%;    

高度:100%;    

width: 134.666666667%;

宽度:134.666666667%;

}

}

.css-flag.sami-portrait {    

.css-flag.sami-portrait {    

height: 74.2574257426%;    

高度:74.2574257426%;    

width: 100%;

宽度:100%;

}

}

Usage

用法

The total CSS file size is 4 MB, and you don't want to send all that data back to the users, so you must use one of the following filters in your plugin or theme.

CSS文件的总大小为4 MB,并且您不想将所有数据发送回用户,因此您必须在插件或主题中使用以下过滤器之一。

css_flags_countries: Load flags for one or more countries

css_flags_countries :为一个或多个国家/地区加载标志

add_filter('css_flags_countries', function() {    

  add_filter('css_flags_countries',function(){    

return array('no');

return array('no');

// Array with ISO_3166-1_alpha-2 country codes: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements

//包含ISO_3166-1_alpha-2国家/地区代码的数组:http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements

});

});

css_flags_regions: Load the flags for one or more regions.

css_flags_regions :加载一个或多个区域的标志。

You can choose between europe, oceania, africa, asia, northamerica, southamerica and middleeast.

您可以在欧洲,大洋洲,非洲,亚洲,北美,南美和中东之间进行选择。

add_filter('css_flags_regions', function() {    

  add_filter('css_flags_regions',function(){    

return array('europe');

return array('europe');

//europe, oceania, africa, asia, northamerica, southamerica, middleeast

//欧洲,大洋洲,非洲,亚洲,北美洲,南美洲,中东

});

});

css_flags_exclude: Exclude some countries from the list.

css_flags_exclude :从列表中排除一些国家。

This filter must be used in combination with the css_flags_countries or css_flags_regions filters

此过滤器必须与 css_flags_countries css_flags_regions 过滤器结合使用

add_filter('css_flags_exclude', function() {    

  add_filter('css_flags_exclude',function(){    

return array('eu');

返回数组('eu');

});

});

css_flags_cachetime: Change the cache time, default it’s 7200 (60x60x2 = 2 hours)

css_flags_cachetime :更改缓存时间,默认为7200(60x60x2 = 2小时)

add_filter('css_flags_cachetime', function() {    

  add_filter('css_flags_cachetime',function(){    

return 172800;

返回172800;

// 2 days

// 2天

});

});

If you must (but you shouldn’t), you can load all the CSS flags using the following:

如果必须(但不应该),则可以使用以下命令加载所有CSS标志:

add_filter('css_flags_countries', function() {    

  add_filter('css_flags_countries',function(){    

return array('all');

return array('all');

// load all country flags (don't it's 4MB)

//加载所有国家(不是4MB)

});

});

More information at GitHub

更多信息,请参见 GitHub

Credits

信用

The original CSS file is from http://www.phoca.cz/cssflags/.

原始CSS文件来自http://www.phoca.cz/cssflags/。

If you only need the CSS file, grab it there.

如果只需要CSS文件,请在那里抓取。

安装步骤

Plugin

插件

    1. Download the latest stable release
    2. 下载最新的稳定版本

    3. Add and activate it.

    4. 添加并激活它。

      This will load the CSS (4 MB) and cache it using the WordPress Transients API.

      这将加载CSS(4 MB)并使用 WordPress Transients API 对其进行缓存。

      The default cache time is 7200. The cache time can be changed using the css_flags_cachetime filter.

    5. 默认的缓存时间是7200。可以使用 css_flags_cachetime 过滤器来更改缓存时间。

    6. Add one of the filters, see Usage above, to your plugin or (child) themes functions.php
    7. 在您的插件或(子)主题函数中添加一个过滤器,请参见上面的用法

    Theme

    主题

      1. Extract the plugin in your (child) theme folder:
      2. 在您的(子)主题文件夹中提取插件:

      3. Add the following to your (child) theme functions.php

        在您的(子)主题函数中添加以下内容。php

        require_once(dirname(__FILE__) . '/css-flags/css-flags.php');

          require_once(dirname(__ FILE__)。'/css-flags/css-flags.php');

      4. Add one of the filters, see Usage above, to your (child) themes functions.php

        将(其中的用法)过滤器添加到(子)主题函数。php

      To get you started, here'a a sample

      要开始使用,这里是一个示例

      theme functions.php

      主题功能.php

下载地址
https://downloads.wordpress.org/plugin/css-flags.0.3.0.zip
-EOF-

AI助手支持GPT4.0