function bfox_tools_create_post_type() { register_post_type('bfox_tool', array('description' => __('Bible Tools', 'bfox'), 'labels' => array('name' => __('Bible Tools', 'bfox'), 'singular_name' => __('Bible Tool', 'bfox'), 'edit_item' => __('Edit Bible Tool', 'bfox'), 'new_item' => __('New Bible Tool', 'bfox'), 'view_item' => __('View Tool', 'bfox')), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'bible-tools'), 'supports' => array('title', 'excerpt', 'thumbnail'), 'register_meta_box_cb' => 'bfox_tools_register_meta_box_cb')); load_bfox_template('config-bfox_tool'); // Scripts /* * Javascript for changing the bible tool via ajax. * Doesn't work for Bible APIs loaded via javascript because we can't inject javascript via javascript * TODO: figure out why our Script element injection isn't working */ wp_enqueue_script('bfox_tool', BFOX_URL . '/bfox_tool.js', array('jquery'), BFOX_VERSION); // declare the URL to the file that handles the AJAX request (wp-admin/admin-ajax.php) // See: http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/ $bfoxAjax = array('ajaxurl' => admin_url('admin-ajax.php')); // Tooltips wp_register_style('bfox-qtip', BFOX_URL . '/external/jquery-qtip/jquery.qtip.css', array(), BFOX_VERSION); wp_register_script('bfox-qtip', BFOX_URL . '/external/jquery-qtip/jquery.qtip.js', array('jquery'), BFOX_VERSION); wp_register_script('bfox-tooltips', BFOX_URL . '/bfox_tooltip.js', array('jquery', 'bfox-qtip', 'bfox_tool'), BFOX_VERSION); if (!bfox_blog_option('disable-tooltips')) { wp_enqueue_style('bfox-qtip'); wp_enqueue_script('bfox-tooltips'); // Bible links add the tooltip by default push_bfox_ref_link_defaults(bfox_ref_link_defaults_tooltip()); $bfoxAjax['tooltipNonce'] = bfox_tool_context_nonce('tooltip'); } wp_localize_script('bfox_tool', 'BfoxAjax', $bfoxAjax); }
function bfox_blog_admin_setting_tooltips() { ?> <input id="bfox-tooltips" name="bfox-blog-options[disable-tooltips]" type="checkbox" value="1" <?php checked(1, bfox_blog_option('disable-tooltips')); ?> /> <p class="description"><?php _e('Bible tooltips are javascript popups that display Scripture when clicking on a Bible reference link.', 'bfox'); ?> </p> <?php }