Tutorial on how to add a copyright prompt to a WordPress theme when copying article content

888u

Last update at :2024-03-13,Edit by888u

This article teaches you how to add a small function in WordPress themes that pops up a copyright prompt when copying article content, and reminds you to indicate the source of the article when reprinting it.

Tutorial on how to add a copyright prompt to a WordPress theme when copying article content:

Method 1:

Through SweetAlert’s beautified prompt box, add the following code to the end of the current theme template function functions.php file:

//Copy success prompt function zm_copyright_tips() { echo ''; echo ''; echo ''; } add_action( 'wp_footer', 'zm_copyright_tips', 100 ); //Finish

Rendering:

The above code directly calls the public library from the external link, and can also download the JS and CSS from the external link to the local to further beautify and modify the style.

Method 2:

If you think that loading JS and CSS will affect the speed, you can also directly use the following code to call the browser's own prompt box. The usage method is the same as above:

//Copy success prompt function zm_copyright_tips() { echo ''; } add_action( 'wp_footer', 'zm_copyright_tips', 100 ); //Finish

Rendering:

Recommended site search: Hong Kong host high-defense US server, Foshan high-defense server, ip proxy server, German server, free overseas server, all-purpose virtual host, Hong Kong ip, which high-defense game server is the best, US server website, < /p>

Tutorial on how to add a copyright prompt to a WordPress theme when copying article content

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码