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

Inserting Taxonomy Terms During a Plugin Activation?

Here is the fixed version of your code. class vsetup { function __construct() { register_activation_hook(__FILE__,array($this,’activate’)); add_action( ‘init’, array( $this, ‘create_taxonomies’ ) ); } function activate() { $this->create_taxonomies(); wp_insert_term(‘Action’,’genre’); wp_insert_term(‘Adventure’,’genre’); } function create_taxonomies() { $genre_args = array( ‘hierarchical’ => true, ‘labels’ => array( ‘name’=> _x(‘Genres’, ‘taxonomy general name’ ), ‘singular_name’ => _x(‘Genre’, ‘taxonomy singular name’), ‘search_items’ … Read more

How should one implement add_settings_error on custom menu pages?

There are several components to error/notice creation and display process: add_settings_error() call to add item to stack (global $wp_settings_errors variable). settings_errors transient that keeps the errors so they survive move from page to page. settings_errors() function get_settings_errors() to retrieve errors from memory or transient and then displays them. These work like a charm for Settings … Read more

How are bulk actions handled in custom list table classes?

Assuming you’re using the standard column_cb() function, the list table will pass the IDs of the selected rows in an array in $_GET, labeled as whatever you assigned to ‘singular’ in the list table’s constructor. Here’s a typical column_cb(): function column_cb($item){ return sprintf( ‘<input type=”checkbox” name=”%1$s[]” value=”%2$s” />’, /*$1%s*/ $this->_args[‘singular’], //Let’s simply repurpose the table’s … Read more

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