Passer la navigation

[Résolu] Custom CPT Icon

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
How can I add a custom icon beyond the limited set offered natively for different CPTs to shop up to the left of the name in the admin menu?

Solution:
I ended up doing it with the third party plugin "Admin Editor Pro" which makes it really easy.

This support ticket is created Il y a 3 years, 1 month. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Fuseau horaire du supporter : America/Sao_Paulo (GMT-03:00)

Ce sujet contient 3 réponses, a 2 voix.

Dernière mise à jour par - Il y a 3 years, 1 month.

Assisté par: Mateus Getulio.

Auteur
Publications
#2634083

jww

How can I add a custom icon beyond the limited set offered natively for different CPTs to shop up to the left of the name in the admin menu?

Thanks.

#2634113

Hey there,

Thank you for contacting our support.

As of now, in order to use custom icons you need to do it with some custom code. Please check this example:

add_filter( 'wpcf_type', 'toolset_add_custom_icon', 10, 2 );
 
function toolset_add_custom_icon( $params, $post_type ) {
 
    // adjust to your needs
    $cpt_slug   = 'toolset-post-type';
 
     
    if( $post_type != $cpt_slug ) {
        return $params;
    }
 
  $params['menu_icon']='any_image_url'; 
 
    return $params;
 
}

Please see some threads where this was done so you can base on to make your own code:

https://toolset.com/forums/topic/unable-to-add-custom-icon-for-custom-post-type/#post-1225119
https://toolset.com/forums/topic/ability-to-add-custom-icon/

Currently, there's no estimate on this feature to be added to the GUI.

Feel free to reply back here if you need further assistance and I'll be happy to help.

Mateus

#2634205

jww

Ok thanks.
I ended up doing it with the third party plugin "Admin Editor Pro" which makes it really easy.

Thanks.

#2634459

Hey there,

Glad that you were able to resolve this. Thank you for sharing the solution!

I hope we are good to close here =)

Feel free to contact us any time if you need assistance with our products.

Kind regards
Mateus