How to show filters on table when using WP_List_Table
How to show filters on table when using WP_List_Table
How to show filters on table when using WP_List_Table
I asked a similar question and got this answer, to query the DB for attachments and dump them into a list. This was the code that was provided to me: $media_query = new WP_Query( array( ‘post_type’ => ‘attachment’, // get attachments only ‘post_status’ => ‘inherit’, // attachments are not ‘published’, so set it to inherit … Read more
I too was struggling with this (only I was sorting by a text-based meta value). Here’s what seems to have fixed the problem: $meta_query = array( ‘relation’ => ‘OR’, array( ‘key’ => ‘property_reference’, ‘value’ => false, ‘type’ => ‘BOOLEAN’, ), array( ‘key’ => ‘property_reference’, ‘compare’ => ‘NOT EXISTS’, ‘value’ => ”, //have to set value … Read more
This is a bug with the wordpress AJAX trying to update manageedit-pagecolumnshidden on the admin table pages when columns are hidden. It completly breaks the entire admin tables when the table headers are visually hidden. Thanks to Michael Ecklund’s clue I was able to figure it out. I created the Ticket here: https://core.trac.wordpress.org/ticket/29030 And a … Read more
Replace $( “.director”, ‘.column-director’ ) by $( “.director, .column-director”) and also replace $ by jQuery
Try the following: add_filter(‘display_post_states’, ‘__return_false’); The function responsible for printing the post state on the post list table is: _post_states() Located in wp-admin/includes/template.php. The following logic determines whether the state will be printed: /** * Filter the default post display states used in the posts list table. * * @since 2.8.0 * * @param array … Read more
$data = $wpdb->get_results($sql, ARRAY_A); Adding ARRAY_A forces get_results() to return an associative array.
Use this to filter the title: add_action( ‘admin_head-edit.php’, ‘wpse264139_edit_post_change_title_in_list’ ); function wpse264139_edit_post_change_title_in_list() { add_filter( ‘the_title’, ‘wpse264139_construct_new_title’, 100, 2 ); }` `function wpse264139_construct_new_title( $title, $id ) { if(get_post_type($id) == ‘post_type’) { $field = get_field(‘place’, $id); return $field . ” ” . $title; } else { return $title; } } NOTE: most of the code came from: … Read more
You have misspelled the filter name. There is an “s” lacking at the end. The correct is manage_cri_creator_posts_columns. As a suggestion, I’d say that it is better to manipulate the existing array rather than creating a complete new one. Might not be your case, but its a good idea to avoid conflicting with other plugins … Read more
wp_get_attachment_image_src(156, ‘archive_thumbnail’)[0] will only echo the URL of the image. You need to add it to html to display the image. Try this: echo ‘<img src=”‘.wp_get_attachment_image_src(156, ‘archive_thumbnail’)[0].'”/>’; You could add the width etc as well echo ‘<img src=”‘.wp_get_attachment_image_src(156, ‘archive_thumbnail’)[0].'” width=”.wp_get_attachment_image_src(156, ‘archive_thumbnail’)[1].” height=”.wp_get_attachment_image_src(156, ‘archive_thumbnail’)[2].” />’; what happens if someone deletes this image though? Do you have … Read more