Create a clickable name in WP_List_Table for Plugin Admin

The WP_List_Table class ultimately uses the single_row_columns method to output each table cell. If we look at that method, we’ll see this part: … elseif ( method_exists( $this, ‘column_’ . $column_name ) ) { echo “<td $attributes>”; echo call_user_func( array( &$this, ‘column_’ . $column_name ), $item ); echo “</td>”; } … Add a method to … Read more

register_activation_hook() not activate plugin

Works perfectly when this code is in main plugin file: <?php function createTable(){ global $wpdb; $query = “CREATE TABLE IF NOT EXISTS ” . $wpdb->prefix .”UsersExtra ( user_id INT NOT NULL, first_name VARCHAR(25) NOT NULL, last_name VARCHAR(25) NOT NULL, address VARCHAR(80) NOT NULL, city VARCHAR(30) NOT NULL, province CHAR(2) NOT NULL, postcode CHAR(7) NOT NULL, … Read more

Add an image gallery to a custom post type?

When you just have raw image files, that you want to assign to a post, wp_insert_attachment will do the job. With attachments already present in your database you can use wp_update_post to set the attachment’s post_parent. Like this: wp_update_post( array( ‘ID’ => $attachment_id, ‘post_parent’ => $parent_post_id, )); To recieve a post’s attachments you can use … Read more

Using ob_start() in plugin

No, this is not a correct use for ob_start(). You’re getting the warning because your script is outputting code before the page headers are sent – meaning you’re printing output before the html page. Without knowing what’s going on in your // other plugin code it’s difficult to say what’s happening exactly. I would guess … Read more