2012年12月5日

wp plugin -19

摘要: THE SETTINGS APIThe Settings API enables you to handle the simple tasks:Tell WordPress that you are going to use some new options and how you want themdisplayed.Specify a function that will sanitize user inputs.And let WordPress transparently manage for you the cumbersome and repetitive parts:Draw m 阅读全文

posted @ 2012-12-05 18:46 kalintw 阅读(135) 评论(0) 推荐(0)

wp plugin -18

摘要: wp_options tableSaving Optionsadd_option( ‘boj_myplugin_color’, ‘red’ );update_option( ‘boj_myplugin_color’, ‘blue’ );Saving an Array of Options< ?php$options = array(‘color’ = > ‘red’,‘fontsize’ = > ‘120%’,‘border’ = > ‘2px solid red’);update_option( ‘boj_myplugin_options’, $options );? 阅读全文

posted @ 2012-12-05 10:17 kalintw 阅读(96) 评论(0) 推荐(0)

2012年12月4日

wp plugin -17

摘要: var_dump( $shortcode_tags );remove_shortcode()remove_all_shortcodes()strip_shortcodes()< ?php$content = < < < SSome existing shortcodes: [amazonimage] [gallery]These don’t exist: [bleh] [123]S;echo strip_shortcodes( $content );/* Result:Some existing shortcodes:These don’t exist: [bleh] 阅读全文

posted @ 2012-12-04 19:55 kalintw 阅读(114) 评论(0) 推荐(0)

wp plugin -16

摘要: Register Custom Shortcodesshortcode 在wordpress中的作用与重要性不言而喻。主要从如下的几个方面考虑:不同格式的shortcode不同格式的shortcode: [book]单模式下的shortcode,使用属性闭合模式 [book 属性] content [/book]多种嵌套shortcode针对不同的custom type来应用 shortcode在编辑器中点击即生成shortcode,即非手动嵌套shortcodeadd_action( 'init', 'sanofi_register_shortcodes' ) 阅读全文

posted @ 2012-12-04 19:34 kalintw 阅读(195) 评论(0) 推荐(0)

wp plugin -15

摘要: Creating a Top - Level Menuadd_menu_page( page_title, menu_title, capability, menu_slug, function,icon_url, position );page_title — The title of the page as shown in the <title> tagsmenu_title — The name of your menu displayed on the dashboardcapability — Minimum capability required to view th 阅读全文

posted @ 2012-12-04 14:15 kalintw 阅读(102) 评论(0) 推荐(0)

wp plugin -14

摘要: CREATING CUSTOM HOOKSdo_action()do_action_ref_array()apply_filters()apply_filters_ref_array()Custom Action Hook Example< ?phpadd_action( ‘plugins_loaded’, ‘boj_myplugin_setup’ );function boj_myplugin_setup() {/* Allow actions to fire before anything else. */do_action( ‘boj_myplugin_setup_pre’ );/ 阅读全文

posted @ 2012-12-04 12:22 kalintw 阅读(129) 评论(0) 推荐(0)

wp plugin -13

摘要: Commonly Used Filter Hooksthe_contentthe_titletemplate_includefront_page_templatehome_templatesingle_templatepage_templateattachment_templatearchive_templatecategory_templatetag_templateauthor_templatedate_templatearchive_templatesearch_template404_templateindex_template 阅读全文

posted @ 2012-12-04 10:51 kalintw 阅读(80) 评论(0) 推荐(0)

2012年12月3日

wp plugin -12

摘要: apply_filters_ref_array( $tag, $args );$tag — The name of the filter hook.$args — An array of arguments to pass to filters registered for the hook.remove_filter( $tag, $function_to_remove, $priority, $accepted_args );$tag — The name of the filter hook to remove a filter from.$function_to_remove — Th 阅读全文

posted @ 2012-12-03 23:32 kalintw 阅读(94) 评论(0) 推荐(0)

wp plugin -11

摘要: apply_filters( $tag, $value );$tag — The name of the filter hook.$value — The parameter passed to any filters added to the hook. The function can alsotake in any number of extraparameters to pass to filters.add_filter( $tag, $function, $priority, $accepted_args );$tag — The name of the hook you want 阅读全文

posted @ 2012-12-03 22:56 kalintw 阅读(144) 评论(0) 推荐(0)

wp plugin -10

摘要: Commonly Used Action Hooks(1)plugins_loaded。一个WP插件应该在此hook做setup。It isfired after most of the WordPress files are loaded but before the pluggable functions and WordPressstarts executing anything;plugins_loaded is executed when all the user’s activated plugins have been loaded by WordPress. Itis also 阅读全文

posted @ 2012-12-03 22:29 kalintw 阅读(131) 评论(0) 推荐(0)

导航