WordPress.org

Forums

Custom Post Type UI
[resolved] Adding icon to the post type (8 posts)

  1. klode
    Member
    Posted 2 years ago #

    I can add the icon for the post type with some code on functions.php of my theme.
    Is there a possibility to integrate this function on your plugin?

    http://wordpress.org/extend/plugins/custom-post-type-ui/

  2. David E. Vargas
    Member
    Posted 2 years ago #

    I agree. This functionality is needed.
    To have something like: 'menu_icon' => plugins_url('/img/my_icon.png', __FILE__) as part of the $args array.

  3. Juergen Schulze
    Member
    Posted 2 years ago #

    yes.... please please please....

  4. RichyVN
    Member
    Posted 2 years ago #

    I just added this to my functions.php file:

    // Add new Custom Post Type icons
    add_action( 'admin_head', 'cpt_icons' );
    function cpt_icons() {
    ?>  <!--escape the regular php dillimeter to allow for regular html below-->
     <style type="text/css" media="screen">
      #menu-posts-cptnamegoeshere .wp-menu-image {
       background: url(<?php bloginfo('url') ?>/wp-content/themes/cpt-icons/iconsmall.png) no-repeat 6px !important;
    		}
    		.icon32-posts-cptnamegoeshere {
    			background: url(<?php bloginfo('url') ?>/wp-content/themes/cpt-icons/iconlarge.png) no-repeat !important;
    		}
        </style>
    <?php }
    ?>

    Then create 2 different png files in the /wp-content/themes/cpt-icons/
    folder and name them: iconsmall.png and iconlarge.png.
    the small icon should be 16x16 pixels and the large one 36x36 pixels.

    Please remember to change the css classnames to your custom posttype.
    So if you have a cpt called "projects" cahnge it to:
    #menu-posts-projects

  5. frafra85
    Member
    Posted 2 years ago #

    this doesn't work.
    "unexpected token rparen found".

    How fix it ?

  6. Juergen Schulze
    Member
    Posted 2 years ago #

    Worked...
    thanks very much.

  7. Michael Beckwith
    Member
    Plugin Author

    Posted 2 years ago #

    frafra85, not sure where that is coming from. I don't believe that "rparen" is part of the plugin code.

  8. Michael Beckwith
    Member
    Plugin Author

    Posted 2 years ago #

    Regarding the menu icon support, noted that down and will get it in the roadmap.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Post Type UI
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags