[英]Custom Post Type List View Column Height & Width
I created a custom post type for creating different type of charts in wordpress. 我创建了一个自定义帖子类型,用于在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: http://s14.postimg.org/szyowvzqp/screenshot_33.png 请在此处查看SCREENSHOT: http : //s14.postimg.org/szyowvzqp/screenshot_33.png
How can I make the chart preview small in size? 如何缩小图表预览的大小?
I wrapped the chart with new to set height and width 100px. 我用新包装图表以将高度和宽度设置为100px。 here is screenshot: http://s14.postimg.org/gcixkdktt/screenshot_35.png Unfortunately, this cut off the chart instead of getting the charts small as the canvas height & width are set.
这是屏幕截图: http : //s14.postimg.org/gcixkdktt/screenshot_35.png不幸的是,由于设置了画布的高度和宽度,因此这会切断图表而不是缩小图表。 Here is result: http://s14.postimg.org/8iibyzd0x/screenshot_34.png
结果如下: http : //s14.postimg.org/8iibyzd0x/screenshot_34.png
One way of doing this would be to add custom styles to wp admin. 一种方法是将自定义样式添加到wp admin。 Either by putting them in the
<head>
or by properly enqueuing them with (this is the preferred way I guess): 通过将它们放入
<head>
或通过适当地将它们加入队列(我猜这是首选方式):
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, eg: 然后,您可以为保存图表的列指定
max-height
,例如:
.chart {
max-height: 50px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.