Ask user permission when activating a plugin

Try the following code: add_action( ‘admin_head’, ‘ask_for_activation’ ); function ask_for_activation() { ?> <script type=”text/javascript”> jQuery(function($){ $(‘span.activate a’).click(function(e){ var c = confirm(‘Are you sure wnat to activate?’) if(!c) { e.preventDefault(); return false; } return true; }); }); </script> <?php } You can add those codes in your functions.php in the theme, if you think your theme … Read more

How Can I Use $wpdb in PayPal IPN file?

Use the ajax api: http://codex.wordpress.org/AJAX_in_Plugins If you let all your ajax calls go through this you will have access to all WP functions. Also take a look at these: http://www.james-vandyne.com/process-paypal-ipn-requests-through-wordpress/ http://wordpress.org/extend/plugins/paypal-framework/ Don’t know if what you want is in there, but worth a look.

Custom post metadata not appearing in public API

Try using the rest_api_allowed_public_metadata filter to whitelist the facebook custom field. It will then appear in the response: add_filter( ‘rest_api_allowed_public_metadata’, ‘jeherve_allow_fb_metadata’ ); function jeherve_allow_fb_metadata() { // only run for REST API requests if ( ! defined( ‘REST_API_REQUEST’ ) || ! REST_API_REQUEST ) return $allowed_meta_keys; $allowed_meta_keys[] = ‘facebook’; return $allowed_meta_keys; }

Build dynamic page from cURL (HTML page) response with plugin

To make this work with WordPress use the AJAX API. While that technically refers to Javascript it will handle any request if the appropriate values are sent. You would create a callback like this one form the Codex: add_action(‘wp_ajax_my_action’, ‘my_action_callback’); function my_action_callback() { global $wpdb; // this is how you get access to the database … Read more

Display content according to current URL

For this to work, you would have to add a rewrite that rewrites https://example.com/[manufacturer slug]/[brand slug] to index.php with e.g. manufacturer=[manufacturer slug]&brand=[brand slug]. e.g.: add_filter( ‘rewrite_rules_array’,’jf_insert_rewrite_rules’ ); function jf_insert_rewrite_rules( $rules ) { $newrules[‘^(.*)/(.*)/?$’] = ‘index.php?manufacturer=$matches[1]&brand=$matches[2]’; return $newrules + $rules; } Remember to goto permalinks page and hit save for the rewrite rules to be updated. … Read more