【发布时间】:2013-12-16 07:34:46
【问题描述】:
对于我的 WordPress 网站,我确实需要能够拥有 this library offers 的功能。
我的问题是是否可以将该 jQuery 插件转换为可工作的 WordPress 插件?如果有,怎么做?
这是制作 init.php 文件的正确方法吗?
<?php
/*
Plugin Name: jQuery Windows
Plugin URI: http://fstoke.me/jquery/window
Description: Sexy jQuery Windows.
Version: 5.03
Author: PC - Prashant Chaudhary
Author URI: http://fstoke.me/jquery/window
License: Creative Commons Attribution-ShareAlike
*/
wp_enqueue_style(
'jquerywindowstyles',
WP_PLUGIN_URL.'/jQuery-windows/css/jquery.window.css',
false,
all);
// Add the scripts to the footer
function jquerywindowjs(){
// Identify our javascript files
wp_register_script(
'jquery.window',
WP_PLUGIN_URL.'/jquery-windows/jquery.window.js',
array( 'jquery' ),
"2.1.4",
1 );
wp_register_script(
'jquery.window.min',
WP_PLUGIN_URL.'/jquery-windows/jquery.window.min.js',
array( 'jquery', 'jquery.window' ),
"1.0",
1 );
// Then enqueue them
wp_enqueue_script( 'jquery.window' );
}
// Action our scripts
add_action( 'wp_enqueue_scripts', 'jquerywindowjs' );
?>
【问题讨论】:
-
你可以在你的主题中安装它,而不用把它做成插件。
标签: jquery jquery-plugins wordpress