Register Page Template from Plugin

You misunderstand what page_template does. It does not create a new template that you will “show up” somewhere and that you can use. It replaces the page.php template provided by the theme. I think that what you want is template_redirect: function custom_page_template( $page_template ) { if (is_home()) { get_header(); echo ‘do stuff’; get_footer(); } } … Read more

Use wp_enqueue_scripts from included php file

I found the problem…. I ran main.php like: function run_this(){ include’path/to/other.php’; } add_shortcode(‘shortcode’, ‘run_this’); And most of the content of other.php came up exept the hooks did’nt work then i tried using add_action(‘init’, ‘run_this’); and then it worked…. exept that i get a fatal error that i cant redeclare some functions twice 😀

Recreating a local repository from a currently existing wordpress.org repo..which I own

Use this URL format for checkout (if using TortoiseSVN, just right click and do checkout from Explorer): http://plugins.svn.wordpress.org/your-plugin-name You will need to use your username/password for WordPress (the account used to publish the plugin) to do any commits. Command line instructions are available direct from WordPress here: https://wordpress.org/plugins/about/svn/

How to delete Passwrd Protected posts cookies when a user logged out from the site

The post password cookie is set with: setcookie( ‘wp-postpass_’ . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST[‘post_password’] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure ); in the wp-login.php file. We can then use the clear_auth_cookie hook, in the wp_clear_auth_cookie() function, to clear it on logout: /** * Clear the Post Password Cookie on logout. * * @link http://wordpress.stackexchange.com/a/198890/26350 */ … Read more

How to override a plugin function wrapped in a class?

if the modification is called in the action admin_menu you can come just after, in order to correct the menu with some code like this : add_action(“admin_menu”, function () { $parent_file=”parent.php”; $full_url = add_query_arg( ‘action’, ‘action-name’, admin_url( ‘users.php’ ) ); global $submenu; // searching the last submenu $last = array_pop($submenu[$parent_file]); // correcting the URL $last[2] … Read more

Widget with same content across several websites

for the idea of storing data on the provider webside, it’s a good idea but I recommend to use JSON onstead of XML. it’s a litte bit faster to parse and you will save a litte bit bandwith on the provider side, you can use the WordPress AJAX helpers to make somethig like that : … Read more