发布时间:2020-09-17
WordPress 后台样式:Button 按钮,
上一篇讲了 ,今天继续,讲讲 WordPress 后台常用的按钮样式:
WordPress 常用到按钮是表单的提交按钮,我们非常简单的使用 submit_button
函数就会生成,比如:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
<?php submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true,
$other_attributes = null ); ?>
$text
代表按钮的文本,默认是“保存更改”。$type
是按钮的 CSS class,包含 ‘primary’,’small’ 和 ‘large’,默认是 ‘primary’,根据这个值的不同显示不同的样式。$name
是提交按钮的 input name,默认是“submit”,如果没有在 $other_attributes
参数中提供 id 属性,那么 $name
也会作为按钮的 id。$wrap
代表生成按钮是否会包含在 p 标签中,默认是包含在 p 标签中。$other_attributes
是按钮的其他属性,可以 key/value 数组也可以是类似 ‘tabindex=”1″‘ 这样的字符串。所以后台生成不同样式的按钮就是靠第三个 $type
参数。
其实 WordPress 是会使用这个参数生成:
这几个 class,如果你想把链接改成按钮样式,也可以使用上面的 CSS class,除此之外,WordPress 还提供了下面这2个 class:
所以只要掌握好这几个 class,在 WordPress 后台根据自己的需求可以做出各种按钮。
专题::
本站推荐使用的主机:,国外主机建议使用。
全站搜索