Vagrant script to setup all the common PHP / WordPress version combinations

On the WordPress side of things, Basic WordPress Vagrant Environment is ready to work with any WordPress version (with a little help). You would still need to find a way to configure the PHP but there is a hint in https://github.com/ideasonpurpose/basic-wordpress-box/blob/master/ansible/roles/php/tasks/php.yml. To use it out of the box; Download or clone the project to wplatest-php55.dev/ … Read more

Passing current cookies in wp_remote_get to get Draft Post Preview

I rarely deal with cookies and not sure about complete mechanics there, but here is basic working example of passing current user’s cookies to retrieve preview page source: $preview_link = set_url_scheme( get_permalink( $post->ID ) ); $preview_link = esc_url( apply_filters( ‘preview_post_link’, add_query_arg( ‘preview’, ‘true’, $preview_link ) ) ); $cookies = array(); foreach ( $_COOKIE as $name … Read more

Add a new tab to WordPress Plugin install Listing

There is the filter: “views_plugin-install” (see here). You can find it in /wp-admin/includes/class-wp-plugin-install-list-table.php (currently) at line 226: $views = apply_filters( “views_{$this->screen->id}”, $views ); Use it like: add_filter( ‘views_plugin-install’, ‘my_filter’, 10, 1 ); function my_filter( $views ){ //Do your stuff return $views; }

Where to put third party PHP library?

If each plugin/theme functions on its own, then you should probably drop the the library in every theme/plugin. Then just check to see if it a class or function from the third-party library exists before requiring it. <?php if( class_exists( ‘SomeClass’ ) ) { // require/include here } or <?php if( function_exists( ‘some_function’ ) ) … Read more

Using a plugin class inside a template

The best way to use your class without knowing the object is an action. You register the action before the theme files for presentation are loaded, WordPress will handle the rest. Sample code: <?php # -*- coding: utf-8 -*- /** * Plugin Name: Plugin Action Demo */ add_action( ‘init’, array ( ‘Plugin_Action_Demo’, ‘init’ ) ); … Read more

Is wp-content/install.php a Drop-in?

To answer your question, Yes In fact, there are many other functions you can override in that file, it’s included as the first line of “wp-admin/includes/upgrade.php” & there are many functions inside to be overridden Unfortunately, there is not too much information available regarding drop-in plugins but i’ll try to put a few points They … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)