include any plugin within other plugin or use other plugin within other

The first plugin, the base, calls do_action() or apply_filters(). The second plugin, the one relying on the the first, uses add_action() or add_filter(). Basic example Base plugin <?php # -*- coding: utf-8 -*- /** * Plugin Name: Base * Plugin URI: http://wordpress.stackexchange.com/q/112075 */ class Plugin_Base { public function __construct() { add_action( ‘wp_loaded’, array ( $this, … Read more

How can I change a plugin’s URL?

For changing the slug, replace the line: ‘rewrite’ => true, at otw-portfolio-light.php inside $args = (…..); for register_post_type( ‘otw-portfolio’, $args ); with: ‘rewrite’ => array(‘slug’ => ‘new-slug’), note: this will be overridden on plugin update additional you might have to go to Dashboard > Settings > Permalinks and save to make changes appear

Add javascript to wp_head with call to plugin options?

Nesting functions in PHP very rarely makes sense. There are some advanced reason for doing it, but I doubt they are needed in this case. class TweetFeedIt { function tweet_feed_it() { function twitter_username_callback() { function tweet_count_callback() { […] } } } } The add_action() function can take up to 4 parameters, but those parameters are … Read more

Is it possible to add a sidebar in a woocommerce hook?

Well I actually figured it out. Leaving the code in case someones need it later: // Add sidebar for shop loop header function my_custom_before_shop_loop_sidebar() { dynamic_sidebar(‘shop-loop-header-sidebar’); } add_action( ‘woocommerce_before_shop_loop’, ‘my_custom_before_shop_loop_sidebar’, 2);

WooCommerce Checkout Error [closed]

Check your WooCommerce System Status to make sure there are no red entries, especially in the Pages section Test your checkout process with the console active Check your server error logs for any entries that relate to the pay page How to use the Google Chrome console : https://developers.google.com/chrome-developer-tools/docs/console How to use FireBug for FireFox … Read more

How can I check if on specific plugin generated page or child

If you’re trying to catch the pattern ‘/forums/user’, you could use PHP’s stringpos function. Something like this should capture what you’re looking for: $url_pattern = “/forums/user”; $requested_uri = $_SERVER[“REQUEST_URI”]; if(strpos($requested_uri, $url_pattern) == 0){ //Your code goes here } Make sure if you have “enforce trailing slashes” set that you use “/forums/user/” as your matching pattern … Read more

Checking instances of scripts in wp_head

wp_script_is() would tell you is the script is enqueued but you’d need to know the handle. If you really need to know if the script is enqueued you will probably have to crawl the $wp_scripts global for the actual file name. Try: global $wp_scripts; var_dump($wp_scripts); // after the wp_enqueue_scripts hook That will dump a huge … Read more