You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过独立WordPress插件在Classic Editor新建文章页添加HTML表单(合规GPLv2)

在Classic Editor新建文章页嵌入HTML表单的尝试

我希望添加一个简易HTML表单,且不破坏Classic Editor插件的原有设计或违反其GPLv2许可协议。

我在classic-editor.php文件中添加了一段简易代码(不确定这是否是最佳方案,我正在开发一个WordPress插件,需要将该表单嵌入到Classic Editor的新建文章页面,因此可能无法使用短代码方式?)。

function myfunction()
{
    // after this next, plain HTML
?>
    <!-- HTML !-->

    <!-- HTML !-->

    <div style="      ">

        <button class="button-2" role="button" style=" display: flex; margin-left:25%;  justify-content: center; ">Button</button>

        <form action="/action_page.php" style="   margin: auto; width: 50%;border: 3px solid black; padding: 10px;">
            <label for="fname">Action:</label><br>
            <input type="text" id="fname" name="fname" value=" "><br>

            <input type="submit" value="Submit">
        </form>
    </div>


    <!-- more HTML code here -->
    <?php   // back to PHP
    // .. some more PHP stuff
    return;
}
myfunction();

表单在页面中的展示效果

内容的提问来源于stack exchange,提问作者Steve

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 03:45:52