Replace existing content from specific WooCommerce admin orders list column

The correct filter hook to be used is manage_edit-shop_order_columns. 1) To remove shipping_address column: add_filter( ‘manage_edit-shop_order_columns’, ‘remove_specific_orders_column’ ); function remove_specific_orders_column( $columns ){ unset( $columns[‘shipping_address’] ); return $new_columns; } Code goes in functions.php file of the active child theme (or active theme). Tested and works. 2) Replace the content of shipping_address column: Here is an example … Read more

Custom Post Types: Custom columns with Title submenu?

I had a similar situation and I based myself on </wp-admin/includes/class-wp-posts-list-table.php>:499 (function single_row {…case ‘title’) Copy the $actions creation block, and associated variables, (which looks something like this) to your manage_{post_type}_posts_custom_column action: $post = get_post( $post_id ); setup_postdata( $post ); $title = _draft_or_post_title(); $post_type_object = get_post_type_object( $post->post_type ); $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID ); $actions … Read more

How to remove Gravatar from Username column

Since there is no special avatar column to unset (the avatars are inside the username column), you could try instead to hide the avatars via css: function hide_avatars_wpse_94126() { if(!current_user_can(‘manage_options’)){ // hide only for non-admins echo “<style>.users td.username img.avatar{display:none !important;}</style>”; } } add_action(‘admin_head-users.php’,’hide_avatars_wpse_94126′); where they are hidden for non-admins. The result will be like this:

Remove “Comment” column in all post-types

I got an alternative : This will not just hiding but disabling also function disable_comments() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if(post_type_supports($post_type,’comments’)) { remove_post_type_support($post_type,’comments’); remove_post_type_support($post_type,’trackbacks’); } } } add_action(‘admin_init’,’disable_comments’);

Make custom post column sortable

You need two additional functions. The first to make the column sortable hooks into the manage_edit-{post_type}_sortable_columns filter… function ws_sortable_manufacturer_column( $columns ) { $columns[‘manufacturer’] = ‘Manufacturer’; return $columns; } add_filter( ‘manage_edit-post_sortable_columns’, ‘ws_sortable_manufacturer_column’ ); and the second hooks into pre_get_posts to manipulate the query to sort by the column… function ws_orderby_custom_column( $query ) { global $pagenow; if … Read more

How I can split text in the_content() into 2 columns?

Did you try css? <div class=”columncontent”> <?php the_content(); ?> </div> Then the css: .columncontent { column-count: 2; } Depending on your theme, you could just find a div already surrounding your content too. There is all sorts of magic there! https://www.w3schools.com/css/css3_multiple_columns.asp The only thing I would suggest is that you use media queries, as the … Read more

Is it possible to create column width presets in Gutenberg?

Just in case anyone else comes looking here’s what I did. First I enqueued a javascript file into the block editor. add_action( ‘enqueue_block_editor_assets’, function () { wp_enqueue_style( ‘block-editor-styles’, get_template_directory_uri(‘styles/gutenberg.css’), false, ‘1.0’, ‘all’ ); wp_enqueue_script( ‘block-editor-scripts’, get_template_directory_uri(‘scripts/gutenberg.js’), array( ‘wp-blocks’, ‘wp-dom’ ), time(), true ); }); Then I just used this bit of code for adding a … Read more

Extend the wp_users table

There are far better ways of doing this. Instead of modifying the user table, make use of User Meta. It has a dedicated table, and works the same way as post meta, but for users. add_user_meta get_user_meta update_user_meta There are many tutorials explaining how to add additional fields to the user profile using User meta … Read more

How can I add columns to custom post tables

I think the manage_{$post_type}_posts_columns filter is what you’re looking for. You can then use the manage_posts_custom_column action to manage the content for each column in the posts list view. EDIT:: To add custom columns to your custom post type, you need to filter the columns being output using the manage_{$post_type}_posts_columns where $post_type is the name … Read more

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