Invision + WordPress integration

the error you see is given by PHP and is giving you a hint that the code you use has not been programmed carefully. It is violating strict standards, in you case, a function is called in a way it should not. That’s basically all. I assume on the server you just have installed the … Read more

Script Code in Text Widget Does NOT Show

[SUMMARY] Although in theory, using the core provided Text Widget should allow you to put any arbitrary HTML code into action, I recently encountered the issue above where the code was wrapped by WordPress in such a way that affected the ability to render properly on Chrome. The code still showed up fine on Firefox … Read more

change $src from wp_register_script in plugins/themes

Well of course you can. All you need to find is what handle they are using for those scripts. let’s say they are uing plugin-script handle. Then you deregister and register script again with your URL. Like this. function wcs_scripts_styles() { wp_deregister_script( ‘plugin-script’ ); wp_register_script( ‘plugin-script’, get_stylesheet_uri(). ‘/js/jquery.script.js’, array( ‘jquery’ ), NULL, true ); } … Read more

WP CLI theme install. Install a private repo?

I actually figured out a way to do this. First you use wget like this: wget –user username –ask-password -O path/to/output.zip https://bitbucket.org/path/to/file.zip the -O flag specifies output and output.zip is where you want it to download to. Then you can run: wp theme install path/to/output.zip –activate Happy days

How can I selectively print scripts to the footer of certain admin pages?

There’s an in_footer parameter that you can pass to wp_enqueue_scripts – does that work? I would hook to admin_enqueue_scripts, check the $page for location, and enqueue your script there, with ‘in_footer’ as true. Example: add_action( ‘admin_enqueue_scripts’, ‘enqueue_my_script’ ); function enqueue_my_script( $page ) { if ($page !== ‘edit.php’) return; wp_enqueue_script( ‘my-script’, ‘http://path/to/my/local/script’, null, null, true ); … Read more

Add conversion/tracking pixel to section for specific post

You can use the wordpress Conditional Tags You can add something like this to your functions.php file: is_single( ‘your-post-slug’ ) add_action( ‘wp_head’, ‘your_function_with_pixel’ ) There are a number of different conditional tags you can use. And your-post-slug can be substituted with the post id as well.

Serving wp-includes (front-end) javascript from a different domain?

Okay, I’ve tried numerous (literally) codes and methods, and failed miserably. So, like I said in the question, the only safe way seems to be re-registering (unregistering and enqueuing) the scripts. The Scripts: http://mywebsite.com/wp-includes/js/comment-reply.js http://mywebsite.com/wp-includes/js/quicktags.js Should be served from: http://example.com/wp-includes/js/comment-reply.js http://example.com/wp-includes/js/quicktags.js Code in functions.php: add_action(‘wp_enqueue_scripts’,’wpse56742_register_script’); function wpse56742_register_script(){ //Register and enqueue Comment Reply script wp_deregister_script(‘comment-reply’); wp_register_script(‘comment-reply’, … Read more

Setting up an API “listening” page

I would use the Rewrite API and the template_redirect action to respond to API requests. As an example, if I wanted to respond to requests directed to the url: example.com/example-path/ with logic in my theme or plugin’s endpoint.php file I would create a rewrite rule and template redirect hook like so: add_action( ‘init’, ‘example_rewrite_rules’ ); … Read more

Add a script as a dependency to a registered script

Digging through https://github.com/WordPress/WordPress/blob/3.5.1/wp-includes/class.wp-dependencies.php all registered scripts are stored in the global $wp_scripts. You can access them directly through that, but I prefer to use the API when it exists. In this case, $wp_scripts->query() returns a particular registered script (a _WP_Dependency object – see source). A _WP_Dependency object stores the dependencies as an array of handles, … Read more