最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - output html on post or page from custom plugin

programmeradmin4浏览0评论
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 5 years ago.

Improve this question

Is there a way to create a plugin that output custom html on a page or post? I can use the shortcode, but if there is another way please let me know.

Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 5 years ago.

Improve this question

Is there a way to create a plugin that output custom html on a page or post? I can use the shortcode, but if there is another way please let me know.

Share Improve this question asked Dec 31, 2019 at 12:30 sialfasialfa 32910 silver badges29 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

To create shortcode write code in the your theme file functions.php

 function my_shortcode_fun() {
        $output = $class = '';
        ob_start(); 
            enter code here....
        $output = ob_get_contents();
        ob_end_clean();
        return $output;
    }
    add_shortcode('my-shortcode', 'my_shortcode_fun');

发布评论

评论列表(0)

  1. 暂无评论