首页 视频课程 主题开发课程第10章、短代码 WordPress短代码介绍

WordPress短代码介绍

2023-06-11 / 261阅

WordPress短代码是一种方便用户在编辑器中添加特定功能的快捷方式。它可以用于插入嵌入式媒体、引用文本、创建按钮、展示表格等等。

短代码的格式为[shortcode],其中shortcode是自定义的名称,可以根据功能来取名,后面可以跟上一些参数来进一步定制效果。

以下是几个常见的短代码及其用法示例:

引用

[quote author="John Doe" link="http://example.com"]This is a quote.[/quote] 

效果:

“This is a quote.” - John Doe

图片

[img src="https://example.com/image.jpg" alt="Alt text" caption="Caption" align="center" width="500px"] 

效果:

Alt text

音频


 

效果:

视频

 

效果:

按钮

[button color="green" size="medium" link="http://example.com"]Click me[/button] 

效果:

表格

[table]
[tr]
[th]Header 1[/th]
[th]Header 2[/th]
[/tr]
[tr]
[td]Row 1, Column 1[/td]
[td]Row 1, Column 2[/td]
[/tr]
[tr]
[td]Row 2, Column 1[/td]
[td]Row 2, Column 2[/td]
[/tr]
[/table] 

效果:

Header 1Header 2
Row 1, Column 1Row 1, Column 2
Row 2, Column 1Row 2, Column 2

以上是几个常见的短代码示例,需要注意的是不同主题所支持的短代码可能有所不同,具体使用时可以参考主题文档来了解可用的短代码及其参数。

阅读文章或者观看视频过程中有任何问题,请下方留言或者联系我Q248758228

大家谈论
    我的见解
    目录