wp_enqueue_script & constants?
The value you pass to wp_enqueue_script should be the URL of the script, not the local file path. wp_enqueue_script(‘my-script’, get_template_directory_uri() . ‘/my-scripts/my-script.js’);
The value you pass to wp_enqueue_script should be the URL of the script, not the local file path. wp_enqueue_script(‘my-script’, get_template_directory_uri() . ‘/my-scripts/my-script.js’);
I don’t know if others CMS or system may use ABSPATH or not but it’s seems to be a generic words. I think I would check for a only-WP constant as WPINC or check if a WordPress function or Class exists
I want to credit @wyck for his answer of setting: define( ‘WP_HTTP_BLOCK_EXTERNAL’, true ); I also just wanted to add that this and a lot of nice other config options are nicely documented in the Codex.
TEMPLATEPATH and STYLESHEETPATH will be deprecated in the near future. It is not safe to rely on these constants. Use get_template_directory() and get_stylesheet_directory() instead. And wait until the init hook (or after_setup_theme before you use them to be sure all needed files are loaded. Example for a plugin: add_action( ‘after_setup_theme’, ‘wpse_50359_set_plugin_basics’ ); function wpse_50359_set_plugin_basics() { … Read more
From the PHP manual on defining namespaces: Namespaces are declared using the namespace keyword. A file containing a namespace must declare the namespace at the top of the file before any other code – with one exception: the declare keyword. To fix the issue, simply make sure that your namespace declaration comes before the other … Read more
I think this is happening because Constants cannot be redefined later. Once they are set, they are fixed. http://php.net/manual/en/language.constants.php I’m not exactly sure how WP language constructs work, but part of me thinks that they are defined, then changed later on the fly when plugins/themes use them. I don’t have a reference for this but … Read more
Once you have same db, you will have same users, so offcouse the password for the user ‘admin’ (please do not use ‘admin’ as username) will be the one setted in database, and of course is the same for the 2 sites, once they shared the db. However you can create users that can login … Read more
Use plugin_dir_url( __FILE__ ); for the URL and plugin_dir_path( __FILE__ ); for the path. Pass the plugin’s main file to both functions to get similar results. Besides that, ADMIN_PATH and ADMIN_DIR are really poor names for custom code. They might result in collisions with other code in the future. Try to use better names, something … Read more
It is defined at the very start of wp-load.php. However it’s value is very primitive – only a path to where file is located, which you could easily get without bothering with including it.
The basic syntax for define() is: define ( $name, $value ) In the above definition, the value is: ( 0755 & ~ umask() ) The ‘&’ (ampersand) is the ‘And’ bitwise operator, the ‘~’ (tilde) is the ‘Not’ bitwise operator, and the umask() function returns the current umask. To answer your question in short (if … Read more