Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to realize the prompt box of publishing right to copy the content of articles

Shulou Source: shulou.com Published: 2022-06-02 03:51:35 10月04日 Update

This article is to share with you about how to copy the content of the article pop-up publishing rights prompt box. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

Code one

A prompt box for beautification through SweetAlert

Add the following code to the end of the current theme template function functions.php file:

Function zm_copyright_tips () {echo'; echo'; echo 'document.body.oncopy = function () {swal ("copy successfully!", "be sure to keep the original link and state the source, thank you for your cooperation!", "success");};} add_action (' wp_footer', 'zm_copyright_tips', 100)

The effect is as shown in the figure:

Code 2:

Simple prompt box

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

Function zm_copyright_tips () {echo 'document.body.oncopy=function () {alert ("copy successfully! please be sure to keep the original link, state the source, thank you for your cooperation!");}';} add_action ('wp_footer',' zm_copyright_tips', 100)

The effect is as shown in the figure:

The above code is directly called by the public library outside the chain, and the JS and CSS of the outer chain can also be downloaded locally to further beautify and modify the style.

Thank you for reading! On how to copy the content of the article pop-up publishing rights prompt box to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

Tags: Tips code content articles publishing rights publishing success original text effects more sources links such as figure collaboration good practical theme usage function file Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Apple MariaDB Shulou Technology Shulou Tech Info