How to Register/Link to .js Files in WordPress Dynamicaly in Header.php

We can use wp_enqueue_scripts action to hook js. If it is inside theme folder then, <?php function my_scripts_method() { wp_enqueue_script( ‘custom-script’, get_stylesheet_directory_uri() . ‘/js/custom_script.js’, array( ‘jquery’ ) ); } add_action( ‘wp_enqueue_scripts’, ‘my_scripts_method’ ); ?> // If it’s for plugin,If it’s for plugin, //use plugins_url( ‘/js/newscript.js’ , __FILE__ ) as path. For ref wp_enqueue_script

WooCommerce custom payment gateway

Right, so the gist is your code; from your description I thought it was someone else’s code you read for inspiration. Your woostripe.php file, which loads your gateway class, bails out before loading the gateway class: // bail on constructor if gateway class isn’t loaded! if (!class_exists(‘WooStripe_Gateway’)) return; // … // why are you attempting … Read more

How specify a directory to file when downloading it

You can try this get the plugin directory: $pluginPath = dirname(_____FILE_____); //plugin path $pluginUrl = WP_PLUGIN_URL . ‘/pluginname/’; //plugin URL good question you just create one template in your plugin directory. there u use the above code. you create one page and assign this template like this add_filter( “template_include”, “yourpage” ) ; function yourpage($single_template) { … Read more

How to call uninstall.php?

Uninstall hook and uninstall.php file are two alternate ways to implement uninstall functionality, they are independent of each other. When uninstall_plugin() is called it checks for uninstall.php or hook (in this order). So if you are using file approach there is nothing special you need to do to call it. WordPress looks it’s up by … Read more