dosc9472 2015-05-09 20:23
浏览 31
已采纳

wordpress中的句柄是什么?

I'm learning to developing in Php and Wordpress. Somebody can explain to me what mean a handle in this context:

<?php wp_enqueue_style( $handle, $src, $deps, $ver, $media ); ?>

Parameters $handle (string) (required) Name used as a handle for the stylesheet. As a special case, if the string contains a '?' character, the preceding part of the string refers to the registered handle, and the succeeding part is appended to the URL as a query string. Default: None

url: https://codex.wordpress.org/Function_Reference/wp_enqueue_style

Thanks!! :)

  • 写回答

1条回答 默认 最新

  • dousi4472 2015-05-09 22:58
    关注

    In general, a handle is just an identifier. In this case, the handle is just a unique name for the script you are enqueuing.

    If you were using wp_register_style, you could use the handle to enqueue the registered style:

    wp_register_style('style-id', get_template_directory_uri() . '/path/to/style.css', array(), '1.0');
    /* ... */
    wp_enqueue_style('style-id');
    

    You can also dequeue styles using the handle as a way to reference the desired style.

    The documentation you referenced pertains to a special case when using wp_enqueue_script. In this instance you can use the handle parameter to also specify a query string for your script:

    wp_enqueue_style('style-handle?query=string', get_template_directory_uri() . '/path/to/style.css', array(), '1.0');
    

    In the above example, the handle is style-handle. The portion after the ? will be added the the enqueued script as a query string.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 MATLAB APP 制作出现问题
  • ¥15 wannier复现图像时berry曲率极值点与高对称点严重偏移
  • ¥15 利用决策森林为什么会出现这样·的问题(关键词-情感分析)
  • ¥15 DispatcherServlet.noHandlerFound No mapping found for HTTP request with URI[/untitled30_war_e
  • ¥15 使用deepspeed训练,发现想要训练的参数没有梯度
  • ¥15 寻找一块做为智能割草机的驱动板(标签-stm32|关键词-m3)
  • ¥15 信息管理系统的查找和排序
  • ¥15 基于STM32,电机驱动模块为L298N,四路运放电磁传感器,三轮智能小车电磁组电磁循迹(两个电机,一个万向轮),怎么用读取的电磁传感器信号表示小车所在的位置
  • ¥15 如何解决y_true和y_predict数据类型不匹配的问题(相关搜索:机器学习)
  • ¥15 PB中矩阵文本型数据的总计问题。