Skip Navigation

[Resolved] Ability to add custom icon

This thread is resolved. Here is a description of the problem and solution.

Problem:
Can we add custom icons to Post Types created with Toolset?

Solution:
https://toolset.com/forums/topic/ability-to-add-custom-icon/#post-586204

This support ticket is created 6 years, 5 months ago. 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 3 replies, has 3 voices.

Last updated by phillipL 6 years, 5 months ago.

Assisted by: Beda.

Author
Posts
#586080

I would love to be able to add a custom icon to the post types shown in the sidebar. Seems like this could be implemented easily enough with a field at the bottom of the choose icon modal. The icons provided work about 75% of the time, but sometimes I think a custom icon would work better. I think this would be a popular feature. Thanks!

#586204

One possibility is to add the Icon with the inbuilt features of Types (we provide a large set of icons as you discovered already).

Another possible approach is to use Custom Code and filter the Post Type you create with Types.
Then add your own custom icon.

You can use the filter wpcf_type.

This lets you filter an array of $params and when you want to change the menu_icon you can it like this:

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;

}

But there is also a Feature filed to allow this directly within the GUI.
I added your voice to it.

#586861

Thanks Beda! The code you provided will fill the gap until the feature is (hopefully) implemented.

#1098578

This works great but only for a single custom post type. How do you add 2 or 3 icons to 2 or 3 custom post types?

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.