网站优化

网站优化

Products

当前位置:首页 > 网站优化 >

如何使用短代码WordPress创建自定义html

GG网络技术分享 2025-03-18 16:12 2


问题描述:

I create a custom payment for WordPress, is a simple code but I need to hide the code, I thought about creating a shortcode [custom_shorcode].

When I put the shortcode i need to display a custom html with php.

图片转代码服务由CSDN问答提供

感谢您的意见,我们尽快改进~

功能建议

我为WordPress创建自定义付款,是一个简单的代码,但我需要隐藏代码,我想创建 一个短代码[custom_shorcode]。</ p>

当我输入短代码时,我需要用php显示一个自定义的html。</ p>

</ div>

网友观点:

You can do this in the functions.php or a simple Plugin.
To create it in the functions.php of your child-theme, do it like this:

add_shortcode(\'your-shortcode\', \'yourFunction\');

function yourFunction(){

//do your stuff

}

You can find the documentation here

标签:

提交需求或反馈

Demand feedback