[php] define ('DIGGTHIS_JS', <%%KEEPWHITESPACE%%> "<script type='text/javascript'> <%%KEEPWHITESPACE%%> (function() { <%%KEEPWHITESPACE%%> var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0]; <%%KEEPWHITESPACE%%> s.type = 'text/javascript'; <%%KEEPWHITESPACE%%> s.async = true; <%%KEEPWHITESPACE%%> s.src = 'http://widgets.digg.com/buttons.js'; <%%KEEPWHITESPACE%%> s1.parentNode.insertBefore(s, s1); <%%KEEPWHITESPACE%%> })(); <%%KEEPWHITESPACE%%> </script>"); function diggthis_add_js_to_doc_head() { <%%KEEPWHITESPACE%%> print DIGGTHIS_JS; } add_action('init','diggthis_add_js_to_doc_head'); [/php] 方法2 [php] add_action( 'wp_enqueue_scripts', 'add_my_script' ); function add_my_script() { <%%KEEPWHITESPACE%%> wp_enqueue_script( <%%KEEPWHITESPACE%%> 'your-script', // name your script so that you can attach other scripts and de-register, etc. <%%KEEPWHITESPACE%%> get_template_directory_uri() . '/js/your-script.js', // this is the location of your script file <%%KEEPWHITESPACE%%> array('jquery') // this array lists the scripts upon which your script depends <%%KEEPWHITESPACE%%> ); } [/php]
CH02用戶資料
- 01取得現在用戶的相關資料
- 02確認現在用戶是否是admin
- 05current_user_can 用來判斷現在這個用戶的權利..
- 05取得現在的URL
- wordpress FTP下載plugin 出現 找不到wp-content ..
- 01 撰寫外掛plugins
- 02 增加編輯頁的sub menu
- 03 add_menu_page 設定用戶
- 04 同時可以在admin 和 author 中使用 控制台..
- 05WordPress的Action Hook與Filter Hook
- 06 wordpress filter 列表
- 後台的「說明」
- 01 admin_head 管理者後台時,head 顯示時..
- 01 HOOK 的原理
- 01官方列表
- 02 admin_notices 管理者後台時,通知管理者動作..
- 04init 添加javasscrupt 連結
- 05wp_head 添加javasscrupt 連結
- admin_footer
- register_activation_hook
- 如何加上javascript
- 設計HOOK和啟動HOOK
- 01官方列表
- 02the_content當顯示文章內容
- 02刪除post
- 03the_content修改內容
- 04mce_buttons_3, 增強編輯氣的工能..
- post_thumbnail_html 和 image_send_to_edit..