Quasi-custom API Call Plugin

You might not need a plugin for this. You can do it this way. Say you are fetching data from WP1 to WP2 instances. create a page in WP1.. say “Custom API” with url /custom-api/. create a template in WP1 named “custom api” in WP1 assign page “Custom API” to template “custom api”. Since your … Read more

Meta box on options page save form problem

It’s not enough to define areas and put metaboxes in them, you must define the layout via the current screen. For example, when displaying a dashboard esque widget area on my custom option page, the first things I have are: global $screen_layout_columns; add_screen_option(‘layout_columns’, array(‘max’ => 3, ‘default’ => 3) ); $screen = get_current_screen(); wp_enqueue_script( ‘dashboard’ … Read more

Plugin development – loading Javascript and Flash

you should use wp_print_scripts hook for your scripts instead of init and in your callback make sure that you are not in the administration pages something like this: add_action(‘wp_print_scripts’,’register_libraries’); function register_libraries(){ if (!is_admin()){ //enqueue your scripts here } } as for adding flash, that should be a separate question just make sure to add more … Read more

unable to wp_enqueue_script(‘suggest’);

As stated on WP Devel, you should always use the appropriate hooks. Else no child theme could deregister the script later. // In your functions.php file function add_suggest_script() { wp_enqueue_script( ‘suggest’, get_bloginfo(‘wpurl’).’/wp-includes/js/jquery/suggest.js’, array(), ”, true ); } add_action( ‘wp_enqueue_scripts’, ‘add_suggest_script’ ); This will load the script from the includes folder and stick in your footer … Read more

post_title is empty on global $post object

This hook is called like this: do_action(“{$new_status}_{$post->post_type}”, $post->ID, $post); My guess is that you should be using data passed as second $post argument, rather than global. So: add_action(‘publish_post’, ‘publish_post’, 10, 2 ); function publish_post($post_id, $post) { // stuff

Proper way to include stylesheet for panels

The best practice method of enqueueing admin stylesheets is to hook into your appearance page’s specific hook, using the admin_print_styles-{hook}, where {hook} = {admin_page}-{menu_slug}. I’ll assume: This is a Theme You are properly using an appearance page, via add_appearance_page() Your $menu_slug is wpse48416-settings The hook, then, is: admin_print_styles-appearance_page_wpse48416-settings: <?php function wpse48416_admin_style(){ wp_register_style( ‘wpse48416_admin_css’, get_template_directory_uri() . … Read more