[wordpress插件] Delay Print CSS延迟打印CSS

wordpress 插件 文章 2020-04-14 19:50 674 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Many browsers will not render your webpage until the print.css is loaded.

在加载print.css之前,许多浏览器都不会渲染您的网页。

Delay Print CSS prevents this from happening.

延迟打印CSS可以防止这种情况的发生。

Once your page has fully rendered (including JavaScript, images, etc) your print stylesheets will be loaded.

页面完全呈现(包括JavaScript,图像等)后,您的打印样式表将被加载。

Using the methods described in a recent blog post

使用最近的博客文章中所述的方法

a> this plugin uses JavaScript, with a non JavaScript fallback, to load your stylesheets last.

a>此插件使用具有非JavaScript后备功能的JavaScript来最后加载样式表。

If your WordPress site uses jQuery then it is used to load the stylesheets, otherwise the plugin outputs its own JavaScript.

如果您的WordPress网站使用jQuery,则将其用于加载样式表,否则插件将输出其自己的JavaScript。

安装步骤

Upload delay-print-css to the /wp-content/plugins/ directory of your install.

将delay-print-css上载至安装目录的 / wp-content / plugins / 目录。

Activate the plugin through the ‘Plugins’ menu in WordPress

通过WordPress中的“插件”菜单激活插件

In your theme or plugin, use wp_register_style and/or wp_enqueue_style to load your CSS.

在主题或插件中,使用 wp_register_style 和/或 wp_enqueue_style 加载CSS。

This requires you to remove any html tags you have in your theme and add the following code to your functions.php file:

这要求您删除主题中包含的所有html标记,并将以下代码添加到您的functions.php文件中:

function mytheme_enqueue_css(){   if (!is_admin()){     wp_enqueue_style (       'mytheme-print', /* handle */       '/path-to/print.css', /* source */       null,

  function mytheme_enqueue_css(){if(!is_admin()){wp_enqueue_style('mytheme-print',/ * handle * /'/path-to/print.css',/ * source * / null, 

/* no requirements */ '1.0', /* version */ 'print' /* media type */ );

/ *不需要* /'1.0',/ *版本* /'print'/ *媒体类型* /);

} } add_action('wp_print_styles', 'mytheme_enqueue_css');

}} add_action('wp_print_styles','mytheme_enqueue_css');

To wrap your stylesheet in conditional tags, add the following below the wp_enqueue_style call in your new function

要将样式表包装在条件标签中,请在新函数的wp_enqueue_style调用下方添加以下内容

global $wp_styles;

 全局$ wp_styles; 

$wp_styles->registered['mytheme-print']->extra['conditional'] = 'IE 6'

$ wp_styles-> registered ['mytheme-print']-> extra ['conditional'] ='IE 6'

下载地址
https://downloads.wordpress.org/plugin/delay-print-css.0.1.zip
-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
[wordpress插件] Apiki WP FAQ查看WP常见问题
[wordpress插件] AP Theme Utility PluginAP Theme Utility插件
[wordpress插件] Disable Errors in Plugins禁用插件错误
[wordpress插件] Clear Cache for Me为我清除缓存
[wordpress插件] Nested Posts by CurateWPCurateWP的嵌套帖子
随便看看
怎么添加小程序支付功能? 4516
教育科技公司申请微信支付被拒绝? 4798
微信公众号免300认证教程 5892
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 5299
小程序广告组件通过审核,但是小程序内没有显示广告? 5067
企业微信通讯录账号被管理员误/恶意删除,怎么办? 9568
问题? 9048
如何快速搭建抽奖助手小程序(无需代码知识) 6177
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 7472
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 6793