i'm trying to add custom filters to a CPT job-offer, for example, i'm starting by locations. the filters works fine except when i try to filter by all locations. this is my code function add_custom_filter_tablenav($post_type){ global $wpdb; /** Ensure this is the correct Post Type*/ if($post_type !== 'job-offer') return; /** Grab the results from the DB */ $query = $wpdb->prepare(' SELECT DISTINCT pm.meta_value FROM %1$s pm LEFT JOIN %2$s p ON p.ID = pm.post_id WHERE pm.meta_key = "%3$s" AND p.post_status …
I have installed Wordpress 5.8.3 which is at the moment the latest version available. I'm trying to hide certain columns within the posts dashboard, but for some reason I doesn't have the option to do that, see: As you can see I have only the pagination options, but the columns are missing. I tried to disable all the plugins installed but same issue. I also tried to reinstall wordpress, but same. How can I fix that?
I've activated the Order feature for my 'portfolio' CPT and have managed to arrange my 'portfolio' posts according to respective Order values I've provided. Unfortunately, I've found that this code locks the order that 'portfolio' items are displayed in admin; I can't toggle the Title ascending/descending feature nor am I able to sort this list by Date. My goal is to display these 'portfolio' items on the live site using the Order feature but I'd still like to be able …
I am looking to add a custom column to a custom post type post listing table in the dashboard. I have read many questions / answers on WPSE, along with this article. Although, it seems like everyone wants to query by meta key / value. I am trying to add a taxonomy value (basically a category) to a custom post type table. I would like the column to be sortable, however I am not understanding the query adjustment. Add the …
I have the following code to add a new column to my taxonomy edit screen (edit-tags.php?taxonomy=book_place&post_type=books) function add_book_place_columns( $columns ) { $columns['foo'] = 'Foo'; return $columns; } add_filter( 'manage_edit-book_place_columns', 'add_book_place_columns' ); function add_book_place_column_content( $content ) { content = 'test'; return $content; } add_filter( 'manage_book_place_custom_column', 'add_book_place_column_content' ); It's working, but I need to access the current term id in the add_book_place_column_content function. How can I do that?
Slowly going crazy over trying to make taxonomy admin columns sortable by a custom field number. I have a custom taxonomy called "typer" and these taxonomies have a custom field called "prioritet". I managed to get my code to show the column, and make it sortable. Only issue is, that the fields are sorted alphabetically, despite all being numbers. thats means that a fieldset of [1, 3, 14, 22] would show as: 1 14 22 3 My code so far …
I have created a custom post type (screen shot below), and would like to change the order of columns. Is it possible to move the "tags" column before the "date" column? Screen shot:
I am in the process of adding an additional column to the Users admin screen to display the company for each user. I have been successful in getting this column to show in the table, but I am really struggling with making it sortable alphabetically. The column header does seem to be activated as sortable, but if i click it to reorganise the list order, the table actually rearranges alphabetically based on the username as opposed to the company. I …
Is it possible to modify the values in the author column in the edit-comments.php section of the backend? A hook? I want to change the mailto field for the commenter's email to include a subject and body. I am pretty sure I found where someone had said there was a way a couple of months ago, but I cannot find it again.
I got a custom post type and link custom posts (issues of a magazine) to the main posts (articles) with relationship ACF. I registered a custom admin column to show issues linked to articles in the articles listing. I echo values of two ACFs used in the custom (issue) post - issue number and issue year to designate the custom post like "2016-04": function add_linked_issue_posts_admin_column($column) { $column['linked_issue_post'] = 'Issue number'; return $column; } add_filter('manage_posts_columns', 'add_linked_issue_posts_admin_column'); function add_linked_issue_post_admin_column_show_value($column_name, $post_ID) { if …
I want to have a column (e.g Send Email) in my custom posts (books) list. In each row there should be a button (Send) and when I click on it I want to send an email. I have seen is a hook manage_posts_custom_column to add custom column but this hook only adds post meta as columns like featured image etc. How to do this, please help me. Screenshot
The title is showing but the content is empty.. I tried following few tutorials time after time but i guess i miss something.. How can i get it to echo 'test' on each col please? // ADD NEW COLUMN function pslider_columns_head($defaults) { $defaults['show_on_page'] = 'Shown on page'; return $defaults; } // SHOW THE VALUE function pslider_columns_content($column_name, $post_ID) { if ($column_name == 'show_on_page') { echo 'test'; } } add_filter('manage_posts_columns', 'pslider_columns_head'); add_action('manage_posts_custom_column', 'pslider_columns_content', 10, 2);
I am getting error Parse error: syntax error, unexpected 'add_filter' (T_STRING), expecting function (T_FUNCTION) when i write the below code in my plugin class file. but this is the only easiest method i saw to get the screen options working. is that code needs to be placed somewhere else? function pippin_set_screen_option($status, $option, $value) { if ( 'pippin_per_page' == $option ) return $value; } add_filter('set-screen-option', 'pippin_set_screen_option', 10, 3);
I want to add the Page URL as a custom column to the Pages admin table. Here is where I am at with the code. Code is in the theme's functions.php. function lrh_modify_page_table( $column ) { $column['lrh_url'] = 'URL'; return $column; } add_filter( 'manage_pages_columns', 'lrh_modify_page_table' ); function lrh_modify_page_table_row( $column_name, $post_id ) { $url = get_permalink( $post_id, true); switch ($column_name) { case 'lrh_url' : echo $url; break; default: } } add_action( 'manage_pages_custom_column', 'lrh_modify_page_table_row', 10, 2 ); Right now it is returning …
EDIT. I got this working, see my own answer below: Now, if someone has any clue as to how I can get this sortable, please chime in! :) ---------------- Original question ---------------- How can I add a custom column to the attachment post type? I'm finding ways to add them to posts, pages or custom post types. But for native post types like attachments, how? I would like to display the attachment file size in it's own column.
I've just installed Forca Theme on my fresh WP installation. They add a few custom taxonomies like: 1 Events Categories - Just categories for Events 2 Events - Same as regular Post, with custom behaviour and template, have assigned Events Categories to it 3 Events Page - Lists ALL Events, no possibility to display from particular Events Category because the Event Page is not associated with ANY Category, it's the Events (Items) themselves that are assigned to categories. So what …
I want to reorder the Company column to be the first column in the table, the code is working fine but it's position is the last one. How can I get it to be in the first before the username? function add_company_column($defaults) { $defaults['company'] = __('Company'); return $defaults; } function view_company_column($value, $column_name, $id) { if ($column_name == 'company') { global $wpdb; $companyID = get_usermeta($id, 'company'); $company = $wpdb->get_row("SELECT com_name FROM " . $wpdb->prefix . "companies WHERE com_id = " . …