How to avoid redefining requirejs in plugin when another plugin also uses requirejs

You could take a look at the enqueued scripts in $wp_scripts ($wp_scripts->registered), but the naming could be different (“it’s requirejs but let’s call it loadstuffjs, just because”), so I doubt it’ll be close to perfect. Also, your plugin might be loaded before the other plugin, and they might trigger the problem without you having any … Read more

Weird post pagination url redirect

That’s actually the default behavior when the post does not have any page breaks (i.e. the <!–nextpage–> tag). More specifically, in redirect_canonical(), WordPress only performs a redirect if the post has the page break tag — and that the page number is invalid (e.g. requesting for page #3 when there are only 2 pages). Otherwise … Read more

Can I apply a WP theme to a specific custom page template?

In fact there is, using template_redirect, which you would put in the functions.php file – Here’s what I use: function uniquename_default_template() { if(get_post_type() == ‘posttype’) : /* You could use is_single() instead of get_post_type() == ” or any type of conditional tag) */ include(TEMPLATEDIR . ‘path/to/theme/file.php’); /* You could use TEMPLATEDIR to get a file … Read more

Workflow and best practice for documentation [closed]

Great question. There is no generic and comprehensive documentation workflow in WordPress circles. However there are some nice tools and options to make use of. readme.txt Markdown-based machine-readable file. It’s main purpose is to be parsed and presented by official plugin repository, but it’s not too convenient outside of that. It is great and fitting … Read more