2014-06-29 04:28 阅读 52


I created a custom post type for creating different type of charts in wordpress. And created a list view column to preview the chart created in each post type. Everything working fine, but the preview chart is showing in original size. I need to get it in small size just to show preview.

Please have a look at SCREENSHOT HERE:

How can I make the chart preview small in size?


I wrapped the chart with new to set height and width 100px. here is screenshot: Unfortunately, this cut off the chart instead of getting the charts small as the canvas height & width are set. Here is result:

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douhezhan5348 douhezhan5348 2014-06-29 07:01

    One way of doing this would be to add custom styles to wp admin. Either by putting them in the <head>or by properly enqueuing them with (this is the preferred way I guess):

    add_action( 'admin_enqueue_scripts', 'load_admin_styles' );
    function load_admin_styles() {
        wp_enqueue_style( 'admin_css_foo', get_template_directory_uri() . '/admin-style-foo.css' );
        wp_enqueue_style( 'admin_css_bar', get_template_directory_uri() . '/admin-style-bar.css' );

    You could then specify a max-height for the column holding the chart, e.g.:

    .chart {
        max-height: 50px;
    点赞 评论 复制链接分享