【问题标题】:how to add text to top of html code with a wordpress plugin?how to add text to top of html code with a wordpress plugin?
【发布时间】:2022-12-01 13:33:15
【问题描述】:

I want to make a wordpress plugin, which displays my copyright at the top of the html code. so if anyone goes on my website and has a look on my website, i can display something like "made with love by my name"

the text should be only visible in the code and not be shown in the front-end.

i know it would be easier to just write the sentence in the html code, but i am trying to make a Wordpress plugin...

and Tips how i could do it? i am a very beginner with php and wordpress.

i created the basis of my plugin with this "plugin-Template"

https://github.com/hlashbrooke/WordPress-Plugin-Template

would be nice if someone could tell me in which .php? file i have to put which code.

i already tried displaying it with echo, but it didnt work...

【问题讨论】:

    标签: php wordpress plugins


    【解决方案1】:

    You should just edit the Wordpress theme and just put it in a HTML comment inside at the beginning of the file (index.php).

    <!-- MADE BY YOUR_NAME -->
    

    【讨论】:

    • yes, but i really want to get started with writing own wp-plugins.. so i think this is a good option to get in touch with it
    【解决方案2】:

    There are a lot of things around your lines that can be ambiguous, but if you had the structure go to /index.php and change these

    <?php
    // phpcs:ignorefile
    // Silence is golden. 
    echo '<!-- i need to learn how to walk before to run -->';
    

    You will see this one line in the code (if the your plugin has been activated) because echo (php) prints an output that does no shows coz this is a COMMENT with the sintaxis of HTML a language to PRINT AN OUTPUT to the user.

    Hope it helps, and keep trying all days!

    【讨论】:

      猜你喜欢
      • 2023-02-01
      • 2022-12-01
      • 2022-12-16
      • 2022-12-27
      • 2023-02-25
      • 2022-07-28
      • 2022-12-02
      • 2022-12-01
      相关资源
      最近更新 更多