Remove Product Page Column Elements

Hello Again Team,

I want to remove the boxed elements on the product page (seen here under a lower custom role). Site is the first site I registered with you guys.

Please help :slight_smile:

Cheers

  • Michael Bissett
    • Recruit

    Hey @Greg, hope you're doing well today! :slight_smile:

    The site I'm seeing Support Access enabled for has a Products page that doesn't quite match the one you've got in the screenshot there (it's missing the "Groups" column, and has some other not shown here).

    That said, I noticed you had an admin branding plugin on the site, which can be used to apply this CSS:

    .post-type-product td.sku.column-sku {
        font-size: 0;
    }
    
    .post-type-product th#sku > a {
        display: none;
    }
    
    .post-type-product select[name="seo_filter"] {
        display: none;
    }
    
    .post-type-product th#wpseo-score > a {
        display: none;
    }
    
    .post-type-product td.wpseo-score.column-wpseo-score > div {
        display: none;
    }

    Could you enable access to the site in question, so that I can target that "Groups" column as well? :slight_smile:

    Please advise,
    Michael

  • Michael Bissett
    • Recruit

    Hey @Greg,

    Where did you try applying the code? I was inserting it into:

    Admin Branding -> CSS and JS

    Also, not seeing that those with an Employer role are presently able to access the products section, did you change something in the meantime? To test, I created a test user, and gave it the Employer role.

    Please advise,
    Michael

  • Greg
    • The Incredible Code Injector

    Alright @Michael Bissett

    My users have to be a vendor in order to see the screen so I think that's why you can't see what I'm referring to. But the admin should reflect the same changes so.

    I added them to Admin Branding and they are gone form the top part but not the bottom? Random right?

    My goal was to remove the entire columns so there was enough room for the other column elements and that they would not have to be so squished.

    See screengrab

    Cheers

  • Michael Bissett
    • Recruit

    Hey @Greg,

    In that case, we'll want to try a different route (I was trying to hide without removing them, as there'd be alignment issues if I removed them with CSS; the sections on the bottom being visible due to that not being targeted with the earlier code). Could you please send in the following for your site via our secure contact form:

    - Mark to my attention, the subject line should contain only: ATTN: Michael Bissett
    - Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.
    - Link back to this thread
    - Include FTP log-in details (hostname, username & password)
    - Include any relevant URLs for your site

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    Thanks! :slight_smile:

    Kind Regards,
    Michael

  • Michael Bissett
    • Recruit

    Hey @Greg,

    I've been able to come up with this so far:

    <?php
    
    function my_manage_columns( $columns ) {
      unset($columns['sku']);
      return $columns;
    }
    
    function my_column_init() {
    	add_filter( 'manage_product_posts_columns' , 'my_manage_columns' );
    }
    add_action( 'admin_init' , 'my_column_init' );

    But I was only able to test it on my own site, as I wasn't able to log in to your site via Support Access. I'll be sending over an email requesting access details, so I can get those other columns removed. :slight_smile:

    Kind Regards,
    Michael

    P.S. Code credit time!

    http://wordpress.stackexchange.com/questions/19180/how-to-remove-a-column-from-the-posts-page/19182#19182

  • Michael Bissett
    • Recruit

    Hey @Greg,

    Thanks for sending those details in! Now, here's the complete package:

    <?php
    
    function my_manage_columns( $columns ) {
      unset($columns['sku']);
      unset($columns['wpseo-score']);
      return $columns;
    }
    
    function my_column_init() {
    	add_filter( 'manage_product_posts_columns' , 'my_manage_columns' );
    }
    add_action( 'admin_init' , 'my_column_init', 11 );

    I still needed to use a bit of CSS, in order to hide that select box:

    .post-type-product select[name="seo_filter"] {
        display: none;
    }

    Can you confirm that those sections have been removed on your end please? :slight_smile:

    Kind Regards,
    Michael

  • Michael Bissett
    • Recruit

    You're welcome @Greg, glad to hear that it worked! :slight_smile:

    For the PHP code, yep, I did insert that as a mu-plugin. The CSS code though, I inserted that into this section inside your site's Dashboard:

    Admin Branding -> CSS and JS

    Hope you have a great weekend, take care! :slight_smile:

    Kind Regards,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.