My site has two custom types: Auction and Lot. Lots are connected to an Auction via the post_parent field. I added an Auction column to the Lots list in the admin area. function theme_lot_custom_columns($columns){ $new = array(); foreach($columns as $key => $value) { if ($key=='date') { // Put the Auction column before the Date column $new['auction'] = __('Auction'); } $new[$key] = $value; } return $new; } add_filter('manage_lot_posts_columns', 'theme_lot_custom_columns'); function theme_lot_custom_column($column, $post_id) { if ($column === 'auction'){ $post = get_post($post_id); if …
I am trying to add a column to one of my custom post types, but only on the edit taxonomy page. I have a taxonomy registered called "event-categories" for my custom post type "events". I can successfully add the custom column to the custom post type edit screen, but can't seem to get the hook to work on the edit taxonomy page. Digging through some of the core, I was able to locate the hook $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, …
First of, this is pretty much an exact duplicate of: Split columns into three+ divs? But the given solution does not work (returns blank). I'm guessing it collides with qTranslate which adds some really weird comments to the html, but i'm not sure. I found a great code snippet that simply splits the content into pieces by the more tag. The problem is it seems to only split into two columns. It ignores the rest of the more tags. I …
I'm customizing the way custom posts are displayed in the backoffice. I'm trying to shift the section that appear on hover (I'm refering to the four buttons Edit, Quick edit, Trash, Preview) in the first column to the second one. The reason is that the section, even if is hidden, takes up space vertically. It seems that the edit section is assigned to the column that is signed with the class column-primary, so I'd like to assign that class to …
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 …
Question How can I change the text at the top of the column into an icon ? Example a star or a thumbs up. Like the "Comment" field. There is no text, just a icon. The files for the plugin is here, if you would take a look. https://github.com/bjovaar/terplugin
Gutenberg gives you some good choices out of the box but is it possible to add a custom preset? I understand I can change the columns manually but was hoping for a preset to make it easier on the client. My other thought was just manually change the 70/30 one to be more 80/20 in the CSS but again for lack of a better option. Any options as far as adding a preset?
I've done this previously but I've forgotten the name of the hook, and can't find it anywhere... What I'm trying to do is add some custom columns in the listing of a custom post type in the admin. For example, in the admin, click on articles, I want to add custom column there.
I have a added custom column to a custom post type, and it works fine. I just want it to sort the names by title, so I tried this, function sortable_custom_columns( $columns ) { $columns['custom_column'] = 'title'; return $columns; } add_filter( 'manage_edit-custom_sortable_columns', 'sortable_custom_columns' ); However, that is returning very random sorting. I think it may have to do with the content of the column? Which I render like this; function location_column_content( $column, $post_id ) { switch ( $column ) { …
I want to use the menu order attribute to control ordering for a custom post type that's going to be used for a specific purpose. It's easy enough to add this to the CPT via supports => array('page-attributes') but how do I expose the menu order value on the admin listing screen for this CPT?
I've created custom taxonomy called 'cities' where you can add cities and added custom field ( radio button ) with 2 options: 'Yes' and 'No' ( never mind what that is ). Everythins is ok, I can get that value and other stuff. Later on I came with idea to add a sortable column ( Like 'Name', 'Slug', 'Posts' etc. ). I've managed to create that column, make it sortable but don't know how to sort those cities by that …
So, my posts have a custom field named "company" and I would like to have a sortable column for this field in the admin area list of posts and also be able to search posts by it's content. I've been able to do both things but not at the same time. That is: the search works but when I try to order it by the company column it goes blank. If I don't do a search, the ordering works fine …
A table list of Products menu of WooCommerce plugin has a custom/extra column, which breaks the text inside it (image-1). If I change the default overflow-wrap: break-word to normal, the text overflows the column's borders (image-2). How do I fix this whole thing? Image-1 Image-2
I have a press release category on my WordPress site and there is too much posts being submitted and its taking up space in the All Posts and Published section of my WordPress admin, I'm wondering if there is a way to create a new sortable column where I can hide press releases category from the All Posts and Published column and make it only show in the new sortable column? Is this possible?
Basically I have 2 custom columns in the 'edit.php' of my custom post type. What I need is when $item_type is set to 'page' but there is no page selected, 'No selection' is echoed (same for when 'media' is set but there is no media file selected). What happens is it's showing the title of the post instead of the proper echo. It works fine for when the page or media file variable is set. Just when it's not set. …
I am having trouble adding custom column to Woocommerce Subscription. My codes are as below: add_filter( 'manage_shop_subscription_posts_columns', function ($columns) { $columns['my_field'] = __('My Field'); return $columns; }, 10); What could be wrong with my code? I fail to understand why it is not working.
I've searched on the internet, and found out this code from this link function remove_upload_columns($defaults) { unset($defaults['comments']); unset($defaults['author']); return $defaults; } add_filter('manage_upload_columns', 'remove_upload_columns'); I put the code into functions.php child theme. It worked, now the Media Library doesn't have author column. Since I want to remove the "Uploaded to" column also, so I add this line to the code above: unset($defaults['uploaded to']); but it didn't work. The "Uploaded to" column in the Media Library still there. I've tried to change …
I have 2 custom columns, typeconsole and console: add_filter('manage_edit-post_sortable_columns', function( $columns ) { $columns['typeconsole'] = 'typeconsole'; $columns['console'] = 'console'; return $columns; }); This answer allows me to sort the first column: Make custom column sortable. When pressing the second column, the first one is ordered. How do I make them work independently?