Month: January 2013

  • send_to_editor get audio address and id

    send_to_editor get audio address and id

    这个方法会导致 WordPress 编辑器原本的插入媒体功能失效! /* * To change this template, choose Tools | Templates * and open the template in the editor. */ add_filter(‘media_send_to_editor’, ‘media_editor’, 1, 3); function media_editor($html, $send_id, $attachment ){ //get the media’s guid and append it to the html //$post = get_post($send_id); //$html .= ”.$send_id.'”‘; $html = str_replace(‘<a’, ‘<a=”” smid=”.$send_id, $html); return $html;…

  • Backstretch Errot: has no method ‘backstretch’

    Backstretch Errot: has no method ‘backstretch’

    a simple jQuery plugin that allows you to add a dynamically-resized, slideshow-capable background image to any page or element Uncaught TypeError: Object function (e,t){return new v.fn.init(e,t,n)} has no method ‘backstretch’ maybe many guys got this error Maybe the issue is ’cause you put $.backstretch([“bg.jpg”]);   ahead of jquery.backstretch.js plugin, try switch the postion.

  • jQuery 向上弹出式菜单

    jQuery 向上弹出式菜单

    Slide Up Menu / jQuery 向上弹出式菜单 The jQuery Slide Up Menu it’s a good alternative to other existing menus giving the possibility to position the menu on the bottom of your header image or at the bottom of the window, acting like Windows Start Menu. You can let it behave like a normal menu or…

  • WordPress MetaBox 里创建带编辑器的可重复字段

    WordPress MetaBox 里创建带编辑器的可重复字段

    在创建页面选择某个页面模板后,在 metabox 里会出现下面的模块,带有 tinyMCE 的文本域。 点击 add new,即可以添加一个新的文本域,点击 remove 可以删除对应的文本域。 对于某个页面里有很对相同小模块的比较有用。 效果如下图: /** * Calls the class on the post edit screen */ function xxxx_repeat_competences_fields($cnt, $p = null) { if ($p === null) { $a = ”; $i = ”; $t = ”; } else { $a = $p[‘a’]; $i = $p[‘i’]; $t = wpautop($p[‘t’]);…

  • WordPress 获取首页 ID

    WordPress 获取首页 ID

    <?php echo get_option(‘page_on_front’); //home page ID echo get_option(‘page_for_posts’); ?>