How to solve a conflict between a plugin and a theme?

If the theme was coded using Theme Development Standards, then you can use the function wp_deregister_script to remove conflicting scripts from the page where the slider is being used. [update] The original solution (at the bottom) worked in a specific plugin situation (with WP Touch). I think this is the proper one: add_action( ‘wp_enqueue_scripts’, ‘wpse_77772_remove_theme_enqueues’, … Read more

Extending WC_Cart in woocommerce

Extending WooCommerce cart class is a bit tricky, but possible. Lets assume you have a plugin and a file class-my-wc-cart.php with extended cart class inside. Then in the main plugin file you need to do following: // load your My_WC_Cart class require_once ‘class-my-wc-cart.php’; // setup woocommerce to use your cart class add_action( ‘woocommerce_init’, ‘wpse8170_woocommerce_init’ ); … Read more

Creating button next to “add media” that allows you to choose a single post

For WP versions before 3.5.0, use the media_buttons_context filter: add_filter( ‘media_buttons_context’, function($context ) { global $pagenow; if ( in_array( $pagenow, array( ‘post.php’, ‘page.php’, ‘post-new.php’, ‘post-edit.php’ ) ) ) { $context .= ‘<a href=”#” class=”button”>Button</a>’; } return $context; } ); For 3.5.0+, use the media_buttons action: add_action( ‘media_buttons’, function($editor_id){ echo ‘<a href=”#” class=”button”>Button</a>’; } ); Both … Read more

Editor access to plugin settings

Unfortunately, the plugin author did not leave room for a filter. But I did request one for you here. I suggested changing: /* Add option page */ function cd_setting_page(){ add_options_page( ‘Commenter data Settings’, ‘Commenter data Settings’, ‘administrator’, ‘commenterdata-settings’, array( $this, ‘cd_renderer’ )); } to /* Add option page */ function cd_setting_page(){ $cap = apply_filters( ‘commenter_data_settings_page_capability_filter’, … Read more

Prevent multisite sites from using a plugin

Multisite is setup to do this by default. If you simply install the plugin without ‘network activating’ it, you are able to limit the use to any single site in the network. To do this, you must be logged in with an account with super-admin rights. Install the plugin on the single-site dashboard > plugins; … Read more